Package jinngine.geometry

Examples of jinngine.geometry.UniformCapsule


    Body right = new Body( "right", new Box(20,200,200));   
    right.setPosition(new Vector3(10,0,0));
    right.setFixed(true);
   
    // create capsules
    UniformCapsule capgeo = new UniformCapsule(2,6);
    Body cap = new Body( "cap", capgeo );
    cap.setPosition(new Vector3(-10,-11,-25));

    UniformCapsule capgeo2 = new UniformCapsule(1.8,5);
    Body cap2 = new Body( "cap2", capgeo2 );
    cap2.setPosition(new Vector3(-10,-11,-25));

    UniformCapsule capgeo3 = new UniformCapsule(1.0,4);
    Body cap3 = new Body( "cap3", capgeo3 );
    cap3.setPosition(new Vector3(-10,-11,-25));

    UniformCapsule capgeo4 = new UniformCapsule(1.6,2);
    Body cap4 = new Body( "cap3", capgeo4 );
    cap4.setPosition(new Vector3(-10,-11,-25));

    // create a box
    Box boxgeometry = new Box(6,3,3);
View Full Code Here


        }
      });
    }
   
    if ( g instanceof UniformCapsule  ) {
      UniformCapsule cap = (UniformCapsule)g;
      final List<Vector3> vertices = new ArrayList<Vector3>();
      final List<Vector3> icoicosahedron = new ArrayList<Vector3>();
     
      // point on icosahedron
//      final double t = (1.0 + Math.sqrt(5.0))/ 2.0;
//      final double S = 1.0 / ( Math.sqrt(1+t*t));
//      icoicosahedron.add(new Vector3(-1,  t,  0));
//      icoicosahedron.add( new Vector3( 1,  t,  0));
//      icoicosahedron.add( new Vector3(-1, -t,  0));
//      icoicosahedron.add( new Vector3( 1, -t,  0));
//      icoicosahedron.add( new Vector3( 0, -1,  t));
//      icoicosahedron.add( new Vector3( 0,  1,  t));
//      icoicosahedron.add( new Vector3( 0, -1, -t));
//      icoicosahedron.add( new Vector3( 0,  1, -t));
//      icoicosahedron.add( new Vector3( t,  0, -1));
//      icoicosahedron.add( new Vector3( t,  0,  1));
//      icoicosahedron.add( new Vector3(-t,  0, -1));
//      icoicosahedron.add( new Vector3(-t,  0,  1));

      ConvexHull icosphere = buildIcosphere(1, 2);
     
      // scale to unit
//      for (Vector3 v: icoicosahedron)
//        v.assign(v.multiply(S) );

      // add two icos to vertices
      Iterator<Vector3> iter = icosphere.getVertices();
      while(iter.hasNext()) {
        Vector3 v = iter.next();
        vertices.add( v.multiply(cap.getRadius()).add(0,0,cap.getLength()/2));
        vertices.add( v.multiply(cap.getRadius()).add(0,0,-cap.getLength()/2));
      }
       
      final ConvexHull hull = new ConvexHull(vertices);
     
      toDraw.add( new DrawShape() {   
View Full Code Here

TOP

Related Classes of jinngine.geometry.UniformCapsule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.