Post Reply 
Bézier Curves (Bezier curves)
01-16-2018, 10:08 PM
Post: #2
RE: Bezier Curves
Bezier curves V0.1 allows the points on a Bezier curve to be generated and drawn.


 LOCAL CRID:="Bézier V0.1 StephenG1CMZ 2018";

 //LOCAL ImpSTEPSZ:=1/(10000-2);//Most Detailed-List Limit
 //! Android: Insufficient Memory may occur. 
 //These steps allow a spline along a diagonal
 //LOCAL GSTEPSZ:=1/(4406-2); //4K
 //LOCAL GSTEPSZ:=1/(2203-2); //HD
 //LOCAL GSTEPSZ:=1/(800-2);//VGA
 //0..1 ALSO IMP>0.001=10000 PTS

 //Generate a point along a Bezier Quadratic curve
 //PERCY AND II: 0..1

 //Generate Bezier Quadratic curve
  LOCAL PTS:={};
  PTS(0):=GBezierQUAD1(XX,YY,1); //(XX(3),YY(3));

 //Generate a point along a Bezier Cubic curve
 //PERCY AND II: 0..1



 //Generate Bezier Cubic curve
  LOCAL PTS:={};

   PTS(0):=GBezierCUBIC1(XX,YY,II); //X AND Y
  PTS(0):=GBezierCUBIC1(XX,YY,1); //(XX(4),YY(4));

 //CONN 0: POINTS 1 BY 1 


 EXPORT IsOnCurve(Points,Point,Rounding)
 //Is PT on curve described by PTS
 //Points:Points comprising curve
 //Point: Search Point (Complex XY)
 //Rounding: −12..12 allows inexact real matches 
 //NB if points change, conclusion may
 //Enhancements: Consider alternatives to rounding
  LOCAL RND:=Rounding;

 EXPORT BezierExample()
 DRAWC({(320/2,240/2)},COLR,CN);//TEST 1 PT
 TEXTOUT_P(SIZE(PTS)+" Points/Bézier",0,200);
 //PRINT("RESULT:POS is "+IsOnCurve({(1,2)},(1,2),0));


Quadratic Bezier and Cubic Bezier are implemented, but Polybeziers are not yet implemented.

Stephen Lewkowicz (G1CMZ)
ANDROID HP Prime App is back
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: Bezier Curves - StephenG1CMZ - 01-16-2018 10:08 PM

User(s) browsing this thread: 1 Guest(s)