예제 #1
0
파일: packs.py 프로젝트: yankang84/woodem
kwMeshes={'color':[1,1,0],'wire':True,'dynamic':False,'material':0}

O.bodies.append(
	pack.regularHexa(
		(pack.inSphere((0,0,4),2)-pack.inSphere((0,-2,5),2)) & pack.notInNotch(centerPoint=(0,0,4),edge=(0,1,0),normal=(-1,1,-1),aperture=.2)
		,radius=rad,gap=gap,color=(0,1,0),material=0) # head
	+[utils.sphere((.8,1.9,5),radius=.2,color=(.6,.6,.6),material=0),utils.sphere((-.8,1.9,5),radius=.2,color=(.6,.6,.6),material=0),utils.sphere((0,2.4,4),radius=.4,color=(1,0,0),material=0)] # eyes and nose
	+pack.regularHexa(pack.inCylinder((-1,2.2,3.3),(1,2.2,3.3),2*rad),radius=rad,gap=gap/3,color=(0.929,0.412,0.412),material=0) #mouth
)
groundId=O.bodies.append(utils.facet([(12,0,-6),(0,12,-6,),(-12,-12,-6)],dynamic=False)) # ground

for part in [
	pack.regularHexa (
		pack.inAlignedBox((-2,-2,-2),(2,2,2))-pack.inCylinder((0,-2,0),(0,2,0),1),
		radius=1.5*rad,gap=2*gap,color=(1,0,1),**kw), # body,
	pack.regularOrtho(pack.inEllipsoid((-1,0,-4),(1,1,2)),radius=rad,gap=0,color=(0,1,1),**kw), # left leg
	pack.regularHexa (pack.inCylinder((+1,1,-2.5),(0,3,-5),1),radius=rad,gap=gap,color=(0,1,1),**kw), # right leg
	pack.regularHexa (pack.inHyperboloid((+2,0,1),(+6,0,0),1,.5),radius=rad,gap=gap,color=(0,0,1),**kw), # right hand
	pack.regularOrtho(pack.inCylinder((-2,0,2),(-5,0,4),1),radius=rad,gap=gap,color=(0,0,1),**kw) # left hand
	]: O.bodies.appendClumped(part)


# Example of geom.facetBox usage 
oriBody = Quaternion(Vector3(0,0,1),(math.pi/3))
O.bodies.append(geom.facetBox((12,0,-6+0.9),(1,0.7,0.9),oriBody,**kwBoxes))

oriBody = Quaternion(Vector3(0,0,1),(math.pi/2))
O.bodies.append(geom.facetBox((0,12,-6+0.9),(1,0.7,0.9),oriBody,**kwBoxes))

oriBody = Quaternion(Vector3(0,0,1),(math.pi))
O.bodies.append(geom.facetBox((-12,-12,-6+0.9),(1,0.7,0.9),oriBody,**kwBoxes))
예제 #2
0
KnifeIDs+=O.bodies.append(geom.facetBox((-lengthKnife/2-radiusKnife,lengthKnife/2,-radiusKnife+buldozerHeight/2),(lengthKnife/2,lengthKnife/2,buldozerHeight/2.),wallMask=47,color=(0,1,0),wire=False))

KnifeIDs+=O.bodies.append(geom.facetBox((-lengthKnife/2-radiusKnife-lengthKnife/4.,lengthKnife/2,-radiusKnife+buldozerHeight*3./2.-buldozerHeight/4.),(lengthKnife/4.,lengthKnife/3.,buldozerHeight/4.),wallMask=47,color=(0,0,1),wire=False))

O.bodies.append(geom.facetBox((0,0,radiusKnife),(lengthKnife*3,lengthKnife*3,lengthKnife),wallMask=16,color=(1,1,1),wire=False,material=facetMat))


### Creating the material for buldozer
colorsph1=Vector3(120,234,150);
colorsph2=Vector3(0,0,1);

colorsph1.normalize();
colorsph2.normalize();
colorSph=colorsph1
for xyz in itertools.product(arange(0,numBoxes[0]),arange(0,numBoxes[1]),arange(0,numBoxes[2])):
	ids_spheres=O.bodies.appendClumped(pack.regularHexa(pack.inEllipsoid((xyz[0]*(sizeBox+gapBetweenBoxes),xyz[1]*(sizeBox+gapBetweenBoxes)+sizeBox*0.5,xyz[2]*(sizeBox+gapBetweenBoxes)-radiusKnife+sizeBox*0.6),(sizeBox/2,sizeBox/2,sizeBox/2)),radius=radiusSph,gap=0,color=colorSph,material=sphereMat))
	if (colorSph==colorsph1):
		colorSph=colorsph2
	else:
		colorSph=colorsph1

O.dt=.2*tc

O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
		[Ip2_ViscElMat_ViscElMat_ViscElPhys()],
		[Law2_ScGeom_ViscElPhys_Basic()],
	),
예제 #3
0
                  color=(1, 1, 1),
                  wire=False))

### Creating the material for buldozer
colorsph1 = Vector3(120, 234, 150)
colorsph2 = Vector3(1, 1, 0)

colorsph1.normalize()
colorsph2.normalize()
colorSph = colorsph1
for xyz in itertools.product(arange(0, numBoxes[0]), arange(0, numBoxes[1]),
                             arange(0, numBoxes[2])):
    ids_spheres = O.bodies.appendClumped(
        pack.regularHexa(pack.inEllipsoid(
            (xyz[0] * (sizeBox + gapBetweenBoxes), xyz[1] *
             (sizeBox + gapBetweenBoxes) + sizeBox * 0.5, xyz[2] *
             (sizeBox + gapBetweenBoxes) - radiusKnife + sizeBox * 0.6),
            (sizeBox / 2, sizeBox / 2, sizeBox / 2)),
                         radius=radiusSph,
                         gap=0,
                         color=colorSph))
    if (colorSph == colorsph1):
        colorSph = colorsph2
    else:
        colorSph = colorsph1

from woo import qt

O.dt = 2 * utils.PWaveTimeStep()  # We do not need now a high accuracy
O.engines = [
    ForceResetter(),
예제 #4
0
파일: packs.py 프로젝트: yankang84/woo
groundId = O.bodies.append(
    utils.facet([(12, 0, -6), (
        0,
        12,
        -6,
    ), (-12, -12, -6)], dynamic=False))  # ground

for part in [
        pack.regularHexa(pack.inAlignedBox(
            (-2, -2, -2), (2, 2, 2)) - pack.inCylinder((0, -2, 0),
                                                       (0, 2, 0), 1),
                         radius=1.5 * rad,
                         gap=2 * gap,
                         color=(1, 0, 1),
                         **kw),  # body,
        pack.regularOrtho(pack.inEllipsoid((-1, 0, -4), (1, 1, 2)),
                          radius=rad,
                          gap=0,
                          color=(0, 1, 1),
                          **kw),  # left leg
        pack.regularHexa(pack.inCylinder((+1, 1, -2.5), (0, 3, -5), 1),
                         radius=rad,
                         gap=gap,
                         color=(0, 1, 1),
                         **kw),  # right leg
        pack.regularHexa(pack.inHyperboloid((+2, 0, 1), (+6, 0, 0), 1, .5),
                         radius=rad,
                         gap=gap,
                         color=(0, 0, 1),
                         **kw),  # right hand
        pack.regularOrtho(pack.inCylinder((-2, 0, 2), (-5, 0, 4), 1),
예제 #5
0
파일: bulldozer.py 프로젝트: CrazyHeex/woo

### Creating the material for buldozer
colorsph1 = Vector3(120, 234, 150)
colorsph2 = Vector3(1, 1, 0)

colorsph1.normalize()
colorsph2.normalize()
colorSph = colorsph1
for xyz in itertools.product(arange(0, numBoxes[0]), arange(0, numBoxes[1]), arange(0, numBoxes[2])):
    ids_spheres = O.bodies.appendClumped(
        pack.regularHexa(
            pack.inEllipsoid(
                (
                    xyz[0] * (sizeBox + gapBetweenBoxes),
                    xyz[1] * (sizeBox + gapBetweenBoxes) + sizeBox * 0.5,
                    xyz[2] * (sizeBox + gapBetweenBoxes) - radiusKnife + sizeBox * 0.6,
                ),
                (sizeBox / 2, sizeBox / 2, sizeBox / 2),
            ),
            radius=radiusSph,
            gap=0,
            color=colorSph,
        )
    )
    if colorSph == colorsph1:
        colorSph = colorsph2
    else:
        colorSph = colorsph1


from woo import qt