class M_Curve

The M_Curve class represents a curve in a vector layer.

Member Functions

int CountPoints()

Returns the number of points that make up the curve.

Return value (int): the number of points that make up the curve

M_Point Point(id)

Returns one of the points making up the curve (use 0 for the first point on the curve).

Return value (M_Point): a point on the curve
id (int): id number of the point

int CountSegments()

Returns the number of segments on the curve. A segment is a section of curve between two control points.

Return value (int): the number of segments on the curve

bool IsSegmentSelected(segID)

Tests whether a segment is selected. (A curve segment is considered selected if the points at either end of it are selected.)

Return value (bool): true if the segment is selected, otherwise false
segID (int): a segment of the curve (starting with 0)

bool IsPointOnSegment(ptID, segID)

Returns true if the given point is on the given curve segment.

Return value (bool): true or false
ptID (int): a point identifier in the underlying mesh
segID (int): a segment of the curve (starting with 0)

bool IsSegmentOn(segID)

Tests whether a given curve segment is on or not. Segments that are "off" do not appear in rendered output.

Return value (bool): true or false
segID (int): segment identifier

void SetSegmentOn(segID, b)

Turns a curve segment on or off.

Return value: none
segID (int): segment identifier
b (bool): true to turn the segment on, false to turn it off

float GetCurvature(ptID, frame)

Returns the curvature through a given point on the curve.

Return value (float): curvature
ptID (int): which point on the curve
frame (int): at what time

void SetCurvature(ptID, curvature, frame)

Sets the curvature through a given point on the curve.

Return value: none
ptID (int): which point on the curve
curvature (float): curvature
frame (int): at what time

LM_Vector2 PointOnSegment(segID, percent)

Returns the location of a point on a segment.

Return value (LM_Vector2): a point located on the segment
segID (int): a segment of the curve (starting with 0)
percent (float): where on the segment to locate the point (from 0 to 1)

Member Variables

fClosed (bool)

true if the curve is closed, otherwise false

class M_Curve {
  int32 GetNumPoints @ CountPoints();
  M_Point *GetPoint @ Point(int32 id);
  AnimVal *GetCurvature @ Curvature(int32 id);
 
  int32 GetNumSegments @ CountSegments();
  bool IsSegmentSelected(int32 segID);
  bool IsPointOnSegment(int32 ptID, int32 segID);
 
  void GetControlPoints(int32 segID, LM_Vector2 *p1, LM_Vector2 *p2, LM_Vector2 *p3, LM_Vector2 *p4, bool forDrawing = false);
 
  bool IsSegmentOn(int32 segID);
  void SetSegmentOn(int32 segID, bool b);
 
  real GetCurvature(int32 ptID, int32 frame);
  void SetCurvature(int32 ptID, real curvature, int32 frame);
 
  LM_Vector2 PointOnSegment(int32 segID, real percent, bool forDrawing = false);
  LM_Vector2 ClosestPointOnSegment(int32 segID, LM_Vector2 vec, bool forDrawing = false);
 
  bool IsSelected();
  bool IsPartiallySelected();
  real CurveLength();
  real SegmentLength(int32 segID);
  LM_Vector2 GetPercentLocation(real percent);
  LM_Vector2 GetPercentTangent(real percent);
  void GetSegmentRange(int32 segID, real *startPercent, real *endPercent);
 
  void SetProfileCurve(MohoLayer *layer, M_Curve *curve);
 
  bool    fClosed;
  AnimVal    fStartPercent;
  AnimVal    fEndPercent;
  int32    fProfileRepeat;
};