Difference between revisions of "Bezier Class"

From Derivative
Jump to navigation Jump to search
(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...")
 
(cleaning)
Tags: 2018.28070 2021.10000
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''BUILD NOTE: Only available in experimental builds 2017.30000+'''<br>
+
{{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]].
 
 
<!--PYH Bezier-->
 
The Bezier class holds a single Bezier primitive. 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.
 
 
 
<!--PYHEND-->
 
 
 
<section begin=MEMBERS />
 
== Members ==
 
 
 
{|style=cellpadding="0" cellspacing="5"
 
 
 
|valign="top"|<code>'''order'''</code>
 
<!--PYHGET order -->
 
||The order of the curve. The order is one more than it's degree.
 
<!--PYHEND-->
 
|-
 
 
 
|valign="top"|<code>'''closed'''</code>
 
<!--PYHGETSET closed-->
 
||Control whether the curve is open (unconnected curve) or closed (solid closed face).
 
<!--PYHEND-->
 
|-
 
 
 
|valign="top"|<code>'''basis'''</code>
 
<!--PYHGET basis-->
 
||The basis as a list of float values.
 
<!--PYHEND-->
 
|-
 
 
 
|valign="top"|<code>'''anchors'''</code>
 
<!--PYHGET anchors-->
 
||The list of anchor [[Vertex Class|vertices]]. 
 
<!--PYHEND-->
 
|-
 
 
 
|valign="top"|<code>'''tangents'''</code>
 
<!--PYHGET tangents-->
 
||The tangents as a list of [[Vertex Class|vertex]] pairs.
 
<!--PYHEND-->
 
|-
 
 
 
|valign="top"|<code>'''segments'''</code>
 
<!--PYHGET segments-->
 
||The list of segments, where each segment is a list of [[Vertex Class|vertices]].
 
<!--PYHEND-->
 
 
 
|}
 
 
 
<section end=MEMBERS /><section begin=METHODS />
 
 
 
== Methods ==
 
 
 
<!--PYHMK appendAnchor-->
 
'''<code>appendAnchor(targetPosition, ''preserveShape=True'')</code> &rarr; <code>Vertex</code>'''
 
:Appends a set of vertices, creating a new segment on the curve, ending with the targetPosition.
 
:Returns final anchor vertex.
 
:* <code>targetPosition</code> - The final target [[Position Class|position]].  The position argument can be any 3-valued tuple.
 
:* <code>preserveShape</code> - '''(Keyword, Optional)''' Specifies whether or not the new tangent will align with the previous segment.
 
<!--PYHEND-->
 
 
 
<!--PYHMK updateAnchor-->
 
'''<code>updateAnchor(anchorIndex, targetPosition, ''tangents=True'')</code> &rarr; <code>Position</code>'''
 
:Modify the anchor vertex to the new position.
 
:Returns resulting position.
 
:* <code>anchorIndex</code> - The index of the anchor vertex to update.
 
:* <code>targetPosition</code> - The final target [[Position Class|position]].  The position argument can be any 3-valued tuple.
 
:* <code>tangents</code> - '''(Keyword, Optional)''' If <code>True</code>, modify neighboring tangent vertices as well.
 
<!--PYHEND-->
 
 
 
<!--PYHMK updateTangent-->
 
'''<code>updateTangent(tangentIndex, targetPosition, ''rotate=True'', ''scale=True'', ''rotateLock=True'', ''scaleLock=True'')</code> &rarr; <code>Position</code>'''
 
:Modify the vertex vertex to the new position, constraining either rotation or scale.
 
:Returns resulting position.
 
:* <code>tangentIndex</code> - The index of the tangent vertex to update.
 
:* <code>targetPosition</code> - The final target [[Position Class|position]].  The position argument can be any 3-valued tuple.
 
:* <code>rotate</code> - '''(Keyword, Optional)''' If <code>True</code> modify the tangent angle.
 
:* <code>scale</code> - '''(Keyword, Optional)''' If <code>True</code> modify the tangent length.
 
:* <code>rotateLock</code> - '''(Keyword, Optional)''' If <code>True</code> modify the matching tangent angle.
 
:* <code>scaleLock</code> - '''(Keyword, Optional)''' If <code>True</code> modify the matching tangent length.
 
<!--PYHEND-->
 
 
 
<!--PYHMV deleteAnchor-->
 
'''<code>deleteAnchor(anchorIndex)</code>'''
 
:Deletes the anchor and its neighboring tangents.
 
:* <code>anchorIndex</code> - The index of the anchor vertex to delete.
 
<!--PYHEND-->
 
 
 
<!--PYHMK insertAnchor-->
 
'''<code>insertAnchor(u)</code> &rarr; <code>Vertex</code>'''
 
:Inserts an anchor at the given position u.
 
:Returns resulting anchor vertex.
 
:* <code>u</code> - The insertion point along the curve (from 0 to 1).
 
<!--PYHEND-->
 
  
<section end=METHODS />
+
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.}}
[[Category:Python Reference]]
+
<section begin=HELPBODY />
 +
{{ClassMemberSection|empty=
 +
|Sectionsummary=
 +
|items=
 +
{{ClassMember
 +
    |class=Bezier
 +
    |name=anchors
 +
    |type=list
 +
    |set=0
 +
    |text=Returns the list of anchor [[Vertex Class|vertices]].}}
 +
{{ClassMember
 +
    |class=Bezier
 +
    |name=basis
 +
    |type=list
 +
    |set=0
 +
    |text=Return the bezier basis as a list of float values.
 +
}}
 +
{{ClassMember
 +
    |class=Bezier
 +
    |name=closed
 +
    |type=bool
 +
    |set=1
 +
    |text=Get or set whether the curve is closed or open.
 +
}}
 +
{{ClassMember
 +
    |class=Bezier
 +
    |name=order
 +
    |type=float
 +
    |set=0
 +
    |text=Return the bezier order. The order is one more than the degree.
 +
}}
 +
{{ClassMember
 +
    |class=Bezier
 +
    |name=segments
 +
    |type=list
 +
    |set=0
 +
    |text=Returns a list of segments, where each segment is a list of [[Vertex Class|vertices]].}}
 +
{{ClassMember
 +
    |class=Bezier
 +
    |name=tangents
 +
    |type=list
 +
    |set=0
 +
    |text=Returns the tangents as a list of [[Vertex Class|vertex]] pairs.}}}}
 +
{{ClassMethodSection|empty=
 +
|Sectionsummary=
 +
|items=
 +
 +
{{ClassMethod
 +
    |class=Bezier
 +
    |name=insertAnchor
 +
    |call=insertAnchor(u)
 +
    |returns=Vertex
 +
    |text=inserts anchor at given position (u from 0..1) and returns anchor vertex.
 +
}}
 +
{{ClassMethod
 +
    |class=Bezier
 +
    |name=updateAnchor
 +
    |call=updateAnchor(anchorIndex, targetPosition, tangents=True)
 +
    |returns=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.}}
 +
{{ClassMethod
 +
    |class=Bezier
 +
    |name=appendAnchor
 +
    |call=appendAnchor(targetPosition, preserveShape=True)
 +
    |returns=Vertex
 +
    |text=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.}}
 +
{{ClassMethod
 +
    |class=Bezier
 +
    |name=updateTangent
 +
    |call=updateTangent(tangentIndex, targetPosition, rotate=True, scale=True, rotateLock=True, scaleLock=True)
 +
    |returns=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.}}
 +
{{ClassMethod
 +
    |class=Bezier
 +
    |name=deleteAnchor
 +
    |call=deleteAnchor(anchorIndex)
 +
    |returns=None
 +
    |text=Deletes the anchor and its neighbouring tangents.
 +
}}}}
 +
<section end=HELPBODY />
 +
{{History}}
 +
{{#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: