-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathUpVectors.py
More file actions
21 lines (18 loc) · 819 Bytes
/
UpVectors.py
File metadata and controls
21 lines (18 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Python 3 version used runpy module to execute scripts from TexGen GUI which requires import of library
from TexGen.Core import *
#Create a textile and yarn
textile = CTextile()
yarn = CYarn()
#Add nodes to the yarn
# First parameter is node position
# Second parameter is tangent at node
# Third parameter is Up vector of node
# Using default 2nd and 3rd parameters results in twisting of yarn
yarn.AddNode( CNode( XYZ(0.25, 5, 0.1), XYZ(0,-1,0), XYZ(0, 0, 1) ) )
yarn.AddNode( CNode( XYZ(0.50, 3, 0), XYZ(0,-1,0), XYZ(0, 0, 1) ) )
yarn.AddNode( CNode( XYZ(0.00, 1, 0), XYZ(0,-1,0), XYZ(0, 0, 1) ) )
yarn.AddNode( CNode( XYZ(0.00, 1, -5), XYZ(0,0,-1), XYZ(0,-1,0) ) )
# Add nodes to the yarn
textile.AddYarn( yarn )
# Add the textile to the TexGen database
AddTextile( "demo", textile )