# Difference between revisions of "Bezier Class"

(cleaning) Tags: 2018.28070 2021.10000 |
|||

(One intermediate revision by the same user not shown) | |||

Line 1: | Line 1: | ||

− | {{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. | + | {{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 | + | 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= | ||

Line 12: | Line 11: | ||

|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 26: | Line 24: | ||

|class=Bezier | |class=Bezier | ||

|name=closed | |name=closed | ||

− | |type= | + | |type=bool |

− | |set= | + | |set=1 |

− | |text= | + | |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 40: | 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 67: | Line 63: | ||

|call=updateAnchor(anchorIndex, targetPosition, tangents=True) | |call=updateAnchor(anchorIndex, targetPosition, tangents=True) | ||

|returns=tdu.Position | |returns=tdu.Position | ||

− | |text=Modify the anchor vertex to the new position. If tangents is True, modify neighboring tangent vertices as well. Returns resulting 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 | {{ClassMethod | ||

|class=Bezier | |class=Bezier | ||

Line 76: | Line 71: | ||

|text=Appends a set of vertices, creating a new segment on the curve, ending with the targetPosition. | |text=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. | + | *preserveShape - (Keyword, Optional) Specifies whether the new tangent will align with the previous segment or not.}} |

− | }} | ||

{{ClassMethod | {{ClassMethod | ||

|class=Bezier | |class=Bezier | ||

Line 83: | Line 77: | ||

|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=tdu.Position | |returns=tdu.Position | ||

− | |text=Modify the vertex vertex to the new position, constraining either rotation or scale. Locked controls matching tangent. Returns resulting 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 | {{ClassMethod | ||

|class=Bezier | |class=Bezier |

## 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]

`anchors`

→ `list`

**(Read Only)**:

Returns the list of anchor vertices.

`basis`

→ `list`

**(Read Only)**:

Return the bezier basis as a list of float values.

`closed`

→ `bool`

:

Get or set whether the curve is closed or open.

`order`

→ `float`

**(Read Only)**:

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

`segments`

→ `list`

**(Read Only)**:

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

`tangents`

→ `list`

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