The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Stretching/compressing curve relative to anchor
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

MMEC

USA
1 Posts

Posted - 07/15/2016 :  11:26:50 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I was wondering if it were possible to stretch and/or compress a 2D curve relative to a fixed anchor point in Orgin 2016? I'm hoping to stretch/compress the curve in question along the x-axis.

Thanks!

Hideo Fujii

USA
1582 Posts

Posted - 07/15/2016 :  2:29:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi MMEC,

If you want to stretch the plot in terms of scale-in or out, you can press Z key, and rotate the mouse wheel.

If you want to change the X values themselves with a factor, similar to the horizontal translation,
there is currently no built-in tool for that, but script like following does such kind of task.
///////////////////////////////////////////////////
clicks=0;
dotool 2; //select tool 2=Screen Reader, 3=Data Reader
type -b Double-click the anchor point twice;
def pointproc {
  clicks++;
  if(clicks<2) type -b Click next anchor point please;
  xx$(clicks)=X;  //x coordinate
  yy$(clicks)=Y;  //y coordinate
  yds$=%C;  //y dataset of the curve
  if(clicks>=2) {
    %A=xof(%C);  //x dataset of the curve
    xbk$=token(%A,1,'_')$;  //book name
    xds$=token(%A,2,'_')$;  //column name
    range rx=[%(xbk$)]1!col(%(xds$)); //x range
    xf=xx2/xx1;  //factor
    rx=rx*xf;
    type -b  factor:$(xf,.2) point1:($(xx1,.2), $(yy1,.2)), point2:($(xx2,.2), $(yy2,.2));
    dotool 0;  //Return to the Arrow tool
  }
}
///////////////////////////////////////////////////


Please try and modify whatever you want.

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 07/15/2016 2:45:12 PM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000