Difference between revisions of "Bezier Class"

From Derivative
Jump to navigation Jump to search
(cleaning)
Tags: 2018.28070 2021.10000
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{TDClassSummary|summary=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.
+
{{TDClassSummary|label=Bezier|summary=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 [[modelSOP Class|Model SOP]] or [[scriptSOP Class|Script SOP]].
 
It can be created from either a [[modelSOP Class|Model SOP]] or [[scriptSOP Class|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.
+
Each curve is described by a set of segments, where each segment is a list of [[Vertex Class|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 [[Vertex Class|vertices]].   See [[Prim Class]] for more details.
+
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.}}
}}
 
 
<section begin=HELPBODY />
 
<section begin=HELPBODY />
 
{{ClassMemberSection|empty=
 
{{ClassMemberSection|empty=
 
|Sectionsummary=
 
|Sectionsummary=
 
|items=
 
|items=
 
 
{{ClassMember
 
{{ClassMember
 
     |class=Bezier
 
     |class=Bezier
 
     |name=anchors
 
     |name=anchors
     |type=
+
     |type=list
 
     |set=0
 
     |set=0
     |text=Returns the list of anchor vertices.
+
     |text=Returns the list of anchor [[Vertex Class|vertices]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=Bezier
 
     |class=Bezier
 
     |name=basis
 
     |name=basis
     |type=
+
     |type=list
 
     |set=0
 
     |set=0
 
     |text=Return the bezier basis as a list of float values.
 
     |text=Return the bezier basis as a list of float values.
Line 27: Line 24:
 
     |class=Bezier
 
     |class=Bezier
 
     |name=closed
 
     |name=closed
     |type=
+
     |type=bool
     |set=0
+
     |set=1
     |text=Controls whether the curve is closed or open.
+
     |text=Get or set whether the curve is closed or open.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=Bezier
 
     |class=Bezier
 
     |name=order
 
     |name=order
     |type=
+
     |type=float
 
     |set=0
 
     |set=0
 
     |text=Return the bezier order. The order is one more than the degree.
 
     |text=Return the bezier order. The order is one more than the degree.
Line 41: Line 38:
 
     |class=Bezier
 
     |class=Bezier
 
     |name=segments
 
     |name=segments
     |type=
+
     |type=list
 
     |set=0
 
     |set=0
     |text=Returns a list of segments, where each segment is a list of vertices.
+
     |text=Returns a list of segments, where each segment is a list of [[Vertex Class|vertices]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=Bezier
 
     |class=Bezier
 
     |name=tangents
 
     |name=tangents
     |type=
+
     |type=list
 
     |set=0
 
     |set=0
     |text=Returns the tangents as a list of vertex pairs.
+
     |text=Returns the tangents as a list of [[Vertex Class|vertex]] pairs.}}}}
}}}}
 
 
{{ClassMethodSection|empty=
 
{{ClassMethodSection|empty=
 
|Sectionsummary=
 
|Sectionsummary=
Line 60: Line 55:
 
     |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 62:
 
     |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 Class|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
 
     |class=Bezier
 
     |class=Bezier
 
     |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
 
     |class=Bezier
 
     |class=Bezier
 
     |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 Class|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
 
     |class=Bezier
 
     |class=Bezier
 
     |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}}

Latest revision as of 19:02, 21 June 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]

anchorslist (Read Only):

Returns the list of anchor vertices.

basislist (Read Only):

Return the bezier basis as a list of float values.

closedbool :

Get or set whether the curve is closed or open.

orderfloat (Read Only):

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

segmentslist (Read Only):

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

tangentslist (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: