Bezier Class

From Derivative
Revision as of 16:23, 1 March 2018 by Markus Heckmann (talk | contribs) (Created page with "'''BUILD NOTE: Only available in experimental builds 2017.30000+'''<br> <!--PYH Bezier--> The Bezier class holds a single Bezier primitive. It is an instance of a Prim Cla...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

BUILD NOTE: Only available in experimental builds 2017.30000+

The Bezier class holds a single Bezier primitive. It is an instance of a Prim Class. It can be created from either a Model SOP or Script SOP. Each curve is described by a set of segments, where each segment is a list of vertices. The first and last vertex of each segment is an anchor position, while its neighboring vertices describe tangent handles.

The members and methods below allow modification of the Bezier in a modelling context, however the Bezier can also be modified by direction manipulation of its vertices. See Prim Class for more details.


Members[edit]

order The order of the curve. The order is one more than it's degree.
closed Control whether the curve is open (unconnected curve) or closed (solid closed face).
basis The basis as a list of float values.
anchors The list of anchor vertices.
tangents The tangents as a list of vertex pairs.
segments The list of segments, where each segment is a list of vertices.


Methods[edit]

appendAnchor(targetPosition, preserveShape=True)Vertex

Appends a set of vertices, creating a new segment on the curve, ending with the targetPosition.
Returns final anchor vertex.
  • targetPosition - The final target position. The position argument can be any 3-valued tuple.
  • preserveShape - (Keyword, Optional) Specifies whether or not the new tangent will align with the previous segment.

updateAnchor(anchorIndex, targetPosition, tangents=True)Position

Modify the anchor vertex to the new position.
Returns resulting position.
  • anchorIndex - The index of the anchor vertex to update.
  • targetPosition - The final target position. The position argument can be any 3-valued tuple.
  • tangents - (Keyword, Optional) If True, modify neighboring tangent vertices as well.

updateTangent(tangentIndex, targetPosition, rotate=True, scale=True, rotateLock=True, scaleLock=True)Position

Modify the vertex vertex to the new position, constraining either rotation or scale.
Returns resulting position.
  • tangentIndex - The index of the tangent vertex to update.
  • targetPosition - The final target position. The position argument can be any 3-valued tuple.
  • rotate - (Keyword, Optional) If True modify the tangent angle.
  • scale - (Keyword, Optional) If True modify the tangent length.
  • rotateLock - (Keyword, Optional) If True modify the matching tangent angle.
  • scaleLock - (Keyword, Optional) If True modify the matching tangent length.

deleteAnchor(anchorIndex)

Deletes the anchor and its neighboring tangents.
  • anchorIndex - The index of the anchor vertex to delete.

insertAnchor(u)Vertex

Inserts an anchor at the given position u.
Returns resulting anchor vertex.
  • u - The insertion point along the curve (from 0 to 1).