Difference between revisions of "Bezier Class"

From Derivative
Jump to navigation Jump to search
Line 60: Line 60:
 
     |name=insertAnchor
 
     |name=insertAnchor
 
     |call=insertAnchor(u)
 
     |call=insertAnchor(u)
     |returns=
+
     |returns=Vertex
     |text=:
+
     |text=inserts anchor at given position (u from 0..1) and returns anchor vertex.
inserts anchor at given position (u from 0..1) and returns anchor vertex.
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 68: Line 67:
 
     |name=updateAnchor
 
     |name=updateAnchor
 
     |call=updateAnchor(anchorIndex, targetPosition, tangents=True)
 
     |call=updateAnchor(anchorIndex, targetPosition, tangents=True)
     |returns=
+
     |returns=tdu.Position
     |text=: -> tdu.Position
+
     |text=Modify the anchor vertex to the new position. If tangents is True, modify neighboring tangent vertices as well. Returns resulting position.
Modify the anchor vertex to the new position. If tangents is True, modify neighbouring tangent vertices as well.
 
Returns resulting position.
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 77: Line 74:
 
     |name=appendAnchor
 
     |name=appendAnchor
 
     |call=appendAnchor(targetPosition, preserveShape=True)
 
     |call=appendAnchor(targetPosition, preserveShape=True)
     |returns=
+
     |returns=Vertex
     |text=: -> Vertex
+
     |text=Appends a set of vertices, creating a new segment on the curve, ending with the targetPosition.
preserveShape - (Keyword, Optional) Specifies whether the new tangent will align with the previous segment or not.
 
Appends a set of vertices, creating a new segment on the curve, ending with the targetPosition.
 
 
Returns final anchor vertex.
 
Returns final anchor vertex.
 +
*preserveShape - (Keyword, Optional) Specifies whether the new tangent will align with the previous segment or not.
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 87: Line 83:
 
     |name=updateTangent
 
     |name=updateTangent
 
     |call=updateTangent(tangentIndex, targetPosition, rotate=True, scale=True, rotateLock=True, scaleLock=True)
 
     |call=updateTangent(tangentIndex, targetPosition, rotate=True, scale=True, rotateLock=True, scaleLock=True)
     |returns=
+
     |returns=tdu.Position
     |text=: -> tdu.Position
+
     |text=Modify the vertex vertex to the new position, constraining either rotation or scale. Locked controls matching tangent. Returns resulting position.
Modify the vertex vertex to the new position, constraining either rotation or scale. Locked controls matching tangent.
 
Returns resulting position.
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 96: Line 90:
 
     |name=deleteAnchor
 
     |name=deleteAnchor
 
     |call=deleteAnchor(anchorIndex)
 
     |call=deleteAnchor(anchorIndex)
     |returns=
+
     |returns=None
     |text=:
+
     |text=Deletes the anchor and its neighbouring tangents.
Deletes the anchor and its neighbouring tangents.
 
 
}}}}
 
}}}}
 
<section end=HELPBODY />
 
<section end=HELPBODY />
 
{{History}}
 
{{History}}
 
{{#invoke:Category|list|Python Reference}}
 
{{#invoke:Category|list|Python Reference}}

Revision as of 17:05, 6 March 2018

A Bezier describes an instance of a single geometry Bezier primitive (containing a set of connected Bezier curves). 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]

anchors(Read Only):

Returns the list of anchor vertices.

basis(Read Only):

Return the bezier basis as a list of float values.

closed(Read Only):

Controls whether the curve is closed or open.

order(Read Only):

Return the bezier order. The order is one more than the degree.

segments(Read Only):

Returns a list of segments, where each segment is a list of vertices.

tangents(Read Only):

Returns the tangents as a list of vertex pairs.

Methods[edit]

insertAnchor(u)Vertex:

inserts anchor at given position (u from 0..1) and returns anchor vertex.

updateAnchor(anchorIndex, targetPosition, tangents=True)tdu.Position:

Modify the anchor vertex to the new position. If tangents is True, modify neighboring tangent vertices as well. Returns resulting position.

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.

  • preserveShape - (Keyword, Optional) Specifies whether the new tangent will align with the previous segment or not.

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

Modify the vertex vertex to the new position, constraining either rotation or scale. Locked controls matching tangent. Returns resulting position.

deleteAnchor(anchorIndex)None:

Deletes the anchor and its neighbouring tangents.

TouchDesigner Build: