예제 #1
0
H0 = ext.TrefoilKnot()
degrees = 0
axis = [0,1,0]
q = aff.HH.rotation_quaternion(degrees,axis[0],axis[1],axis[2])
scale = 1.
s = [scale,scale,scale] # the same scale as previous for caps
t = [-80,0,50.]
pts = H0['pts']
q = aff.HH.rotation_quaternion(degrees,axis[0],axis[1],axis[2])
C = aff.Center(pts)
pts = aff.Translate(pts,-C[0],-C[1],-C[2],align=False)
pts = aff.Rotate(pts,q,align=False)
pts = aff.Scale(pts, s[0],s[1],s[2],align=False)
pts = aff.Translate(pts,t[0],t[1],t[2],align=False)
H0['pts'] = pts
Gs = ext.Append(Gs,H0)
G = ext.GraphUnionS(G,H0)

# square table
H1 = SquareTable1()
Gs = ext.Append(Gs,H1)
G = ext.GraphUnionS(G,H1)

# N1 x N2 water bottles
N1 = 1
N2 = 1
for j in range(N2):
    for i in range(N1):
        H2 = rc.WaterBottle(n=10)
        degrees = -90
        axis = [0,1,0]
예제 #2
0
BIGDATA = r"C:/_BigData/_3D/my_scenes/"

G = {}
G['V'] = []
G['E'] = []
G['F'] = []
G['N'] = []
G['pts'] = []
Gs = []

w, h, d = 10, 10, 10
degrees = 90
axis = [0, 0, 1]
q = ext.aff.HH.rotation_quaternion(degrees, axis[0], axis[1], axis[2])
t = [-50, 0, 0]
s = [1, 1, 1]
G2 = ext.CubeObj(w, h, d, t, q, s)
Gs = ext.Append(Gs, G2)
G = ext.GraphUnionS(G, G2)

#H = Parabola()
H = ext.TrefoilKnot()
Gs = ext.Append(Gs, H)
G = ext.GraphUnionS(G, H)

ext.Graph2OBJ(BIGDATA + "extrude-1.obj", G, "scene")
import os
print("Open extrude-1.obj with 3D Viewer by double-clicking on it")
os.system(BIGDATA + "extrude-1.obj")
예제 #3
0
G = {}
G['V'] = []
G['E'] = []
G['F'] = []
G['N'] = []
G['pts'] = []
Gs = []

# Ellipsoid Object
r = 10  # radius of cross section
a = 50  # radius of helix, must be big enough
b = 10  # pitch
t = [-80., 0., 50.]
degrees = 0
axis = [0, 1, 0]
q = aff.HH.rotation_quaternion(degrees, axis[0], axis[1], axis[2])
scale = 1.
s = [scale, scale, scale]  # the same scale as previous for caps
# n is length
H0 = he.Helix(r, a, b, t, q, s, m=10, n=20, N=10)
Gs = ext.Append(Gs, H0)
G = ext.GraphUnionS(G, H0)
#################################

# Save Scene 1
ext.Graphs2OBJ(BIGDATA + "Helix2.obj", Gs, "scene")

# Double-Click on OBJ file
import os
os.system(BIGDATA + "Helix2.obj")
예제 #4
0
r = 20.
t = deepcopy(goal)
degrees = 90
axis = [0, 0, 1]
q = aff.HH.rotation_quaternion(degrees, axis[0], axis[1], axis[2])
scale = 3.
s = [scale, scale, scale]  # the same scale as previous for caps
H1 = rc.WaterBottle(n=30)
pts = H1['pts']
C = aff.Center(pts)
pts = aff.Translate(pts, -C[0], -C[1], -C[2], align=False)
pts = aff.Rotate(pts, q, align=False)
pts = aff.Scale(pts, s[0], s[1], s[2], align=False)
pts = aff.Translate(pts, t[0], t[1], t[2], align=False)
H1['pts'] = pts
Gs = ext.Append(Gs, H1)
G = ext.GraphUnionS(G, H1)

N = 10
degrees = 0
axis = [0, 1, 0]
qp = aff.HH.rotation_quaternion(degrees, axis[0], axis[1], axis[2])
scale = 1.
sp = [scale, scale, scale]  # the same scale as previous for caps
for i in range(N):
    Puma560.P, flag = Puma560.Reach(Puma560.P, goal)
    print(i, flag, Puma560.P.Start())
    G1 = Puma560.P.Graph()

    H2 = BodyGraph(G, Gs, G1, Puma560.P.pt, qp, sp)
    Gs = ext.Append(Gs, H2)