Difference between revisions of "Point Class"

From TouchDesigner Documentation
Jump to: navigation, search
(Point Class Auto Create)
 
m
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{lowercase}}
+
{{TDClassSummary|label=Point|summary=A Point describes an instance to a single [[Point|geometry point]].  They are accessible through the [[SOP Class|SOP.points]] member.}}
{{TDClassSummary|summary=A Point describes an instance to a single geometry point.  They are accessible through the SOP.points member.}}
+
{{ClassMemberSection|empty=
{{ClassMemberSection|empty=}}
+
|Sectionsummary=
 +
|items=
 
{{ClassMember
 
{{ClassMember
 
     |class=Point
 
     |class=Point
     |name=P
+
     |name=index
     |returns=
+
     |type=int
 
     |set=0
 
     |set=0
     |text=The coordinates as AttributeData.  Individual components can be read or written with the [] operator.
+
     |text=The point index in the list.
point.P[0] = 5
 
point.P = (1,0,1)
 
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=Point
 
     |class=Point
 
     |name=owner
 
     |name=owner
     |returns=
+
     |type=OP
 
     |set=0
 
     |set=0
     |text=The OP to which this object belongs.
+
     |text=The [[OP Class|OP]] to which this object belongs.}}
}}
+
{{ClassMember
 +
    |class=Point
 +
    |name=P
 +
    |type=td.AttributeData
 +
    |set=1
 +
    |text=The coordinates as [[AttributeData Class|AttributeData]]. Individual components can be read or written with the [] operator.
 +
<syntaxhighlight lang=python>
 +
point.P[0] = 5
 +
point.P = (1,0,1)
 +
</syntaxhighlight>}}
 
{{ClassMember
 
{{ClassMember
 
     |class=Point
 
     |class=Point
 
     |name=x
 
     |name=x
     |returns=
+
     |type=float
     |set=0
+
     |set=1
 
     |text=Get or set x coordinate value. This is the same as P[0].
 
     |text=Get or set x coordinate value. This is the same as P[0].
 
}}
 
}}
Line 28: Line 36:
 
     |class=Point
 
     |class=Point
 
     |name=y
 
     |name=y
     |returns=
+
     |type=float
     |set=0
+
     |set=1
 
     |text=Get or set y coordinate value. This is the same as P[1].
 
     |text=Get or set y coordinate value. This is the same as P[1].
 
}}
 
}}
Line 35: Line 43:
 
     |class=Point
 
     |class=Point
 
     |name=z
 
     |name=z
     |returns=
+
     |type=float
     |set=0
+
     |set=1
 
     |text=Get or set z coordinate value. This is the same as P[2].
 
     |text=Get or set z coordinate value. This is the same as P[2].
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=Point
 
     |class=Point
     |name=index
+
     |name=normP
     |returns=
+
     |type=tdu.Position
 
     |set=0
 
     |set=0
     |text=The point index in the list.
+
     |text=The normalized position of this point within the bounding box of the SOP. Will always be in the range [0,1]. Expressed as tdu.Position object.
 
}}
 
}}
{{ClassMethodSection|empty=}}
+
{{SubSection|title=Attributes
 +
|text=In addition to the above members, all [[Attribute Class|attributes]] are members as well.
 +
 
 +
For example, if the Point contains texture coordinates, they may be accessed with:<code>Point.uv</code>
 +
 
 +
<syntaxhighlight lang=python>
 +
box = op('box1')
 +
print(box.N[0], box.N[1], box.N[2])
 +
print(box.uv[0], box.uv[1], box.uv[2])
 +
</syntaxhighlight>
 +
See: [[Attribute Class]] for more information.
 +
}}}}
 +
{{ClassMethodSection|empty=
 +
|Sectionsummary=
 +
|items=
 
{{ClassMethod
 
{{ClassMethod
 
     |class=Point
 
     |class=Point
 
     |name=destroy
 
     |name=destroy
 
     |call=destroy()
 
     |call=destroy()
     |returns=
+
     |returns=None
     |text=:
+
     |text=Destroy and remove the actual point this object refers to. This operation is only valid when the primitive belongs to a [[scriptSOP Class|scriptSOP]]. Note: after this call, other existing Point objects in this SOP may no longer be valid.}}}}
Destroy and remove the actual point this object refers to. This operation is only valid when the primitive belongs to a scriptSOP.
+
{{History}}
Note: after this call, other existing Point objects in this SOP may no longer be valid.
+
{{#invoke:Category|list|Python Reference}}
}}
 
<taggedhistory/>
 
 
 
{{{{#invoke:Category|list|Python Reference}}}}
 

Latest revision as of 11:38, 8 May 2020

A Point describes an instance to a single geometry point. They are accessible through the SOP.points member.


Members[edit]

indexint (Read Only):

The point index in the list.

ownerOP (Read Only):

The OP to which this object belongs.

Ptd.AttributeData :

The coordinates as AttributeData. Individual components can be read or written with the [] operator.

point.P[0] = 5
point.P = (1,0,1)

xfloat :

Get or set x coordinate value. This is the same as P[0].

yfloat :

Get or set y coordinate value. This is the same as P[1].

zfloat :

Get or set z coordinate value. This is the same as P[2].

normPtdu.Position (Read Only):

The normalized position of this point within the bounding box of the SOP. Will always be in the range [0,1]. Expressed as tdu.Position object.

Attributes[edit]

In addition to the above members, all attributes are members as well.

For example, if the Point contains texture coordinates, they may be accessed with:Point.uv

box = op('box1')
print(box.N[0], box.N[1], box.N[2])
print(box.uv[0], box.uv[1], box.uv[2])

See: Attribute Class for more information.

Methods[edit]

destroy()None:

Destroy and remove the actual point this object refers to. This operation is only valid when the primitive belongs to a scriptSOP. Note: after this call, other existing Point objects in this SOP may no longer be valid.

TouchDesigner Build:

Each SOP has a list of Points. Each point has an XYZ 3D position value plus other optional attributes. Each polygon Primitive is defined by a vertex list, which is list of point numbers.

Any of the procedural data operators. OPs do all the work in TouchDesigner. They "cook" and output data to other OPs, which ultimately result in new images, data and audio being generated. See Node.

An Operator Family that reads, creates and modifies 3D polygons, curves, NURBS surfaces, spheres, meatballs and other 3D surface data.

Information associated with SOP geometry. Points and primitives (polygons, NURBS, etc.) can have any number of attributes - position (P) is standard, and optional are normals (N), texture coordinates (uv), color (Cd), etc.