Examples of Circle


Examples of lineage2.commons.geometry.Circle

   * @param shape Element
   * @return Circle * @throws Exception
   */
  public static Circle parseCircle(Element shape) throws Exception
  {
    Circle circle;
    String[] coord = shape.attribute("loc").getValue().split("[\\s,;]+");
    if (coord.length < 5)
    {
      circle = new Circle(Integer.parseInt(coord[0]), Integer.parseInt(coord[1]), Integer.parseInt(coord[2])).setZmin(World.MAP_MIN_Z).setZmax(World.MAP_MAX_Z);
    }
    else
    {
      circle = new Circle(Integer.parseInt(coord[0]), Integer.parseInt(coord[1]), Integer.parseInt(coord[2])).setZmin(Integer.parseInt(coord[3])).setZmax(Integer.parseInt(coord[4]));
    }
    return circle;
  }
View Full Code Here

Examples of lt.refactory.primsAlgo.service.algorithm.models.Circle

    try {
      Graph<WeightedEdge> firstEquilateralTriangle = SteinersAlgorithm.getEquilateralTriangle(firstTriangle);
      Graph<WeightedEdge> secondEquilateralTriangle = SteinersAlgorithm.getEquilateralTriangle(secondTriangle);
      Graph<WeightedEdge> thirdEquilateralTriangle = SteinersAlgorithm.getEquilateralTriangle(thirdTriangle);
     
      Circle firstCircle = SteinersAlgorithm.getCircumscribedCircle(firstEquilateralTriangle);
      Circle secondCircle = SteinersAlgorithm.getCircumscribedCircle(secondEquilateralTriangle);
      Circle thirdCircle = SteinersAlgorithm.getCircumscribedCircle(thirdEquilateralTriangle);
     
      // test if circles got any radius
      assertTrue(firstCircle.getRadius().compareTo(BigDecimal.ZERO) == 1);
      assertTrue(secondCircle.getRadius().compareTo(BigDecimal.ZERO) == 1);
      assertTrue(thirdCircle.getRadius().compareTo(BigDecimal.ZERO) == 1);
     
      // test what values should be aproximately
      assertTrue(firstCircle.getCenterPoint().getPointX().compareTo(BigDecimal.ZERO) == -1);
      assertTrue(firstCircle.getCenterPoint().getPointY().compareTo(BigDecimal.valueOf(2)) == 0);
     
      assertTrue(secondCircle.getCenterPoint().getPointX().compareTo(BigDecimal.ONE) == 1);
      assertTrue(secondCircle.getCenterPoint().getPointY().compareTo(BigDecimal.valueOf(2)) == 1);
     
      assertTrue(thirdCircle.getCenterPoint().getPointX().compareTo(BigDecimal.valueOf(1.5)) == 0);
      assertTrue(thirdCircle.getCenterPoint().getPointY().compareTo(BigDecimal.ZERO) == -1);
     
    } catch (AddEdgeException e) {
      fail("Add edge exception thrown");
    }
  }
View Full Code Here

Examples of net.algart.arrays.demo.CombinedArraysDemo.Circle

            for (int k = from; k < to; k++)
                ja[k] = k - from + startValue + "";
        } else if (javaArray instanceof Circle[]) {
            Circle[] ja = (Circle[]) javaArray;
            for (int k = from; k < to; k++)
                ja[k] = new Circle(k - from + startValue, -(k - from + startValue), k - from + startValue);
        } else {
            throw new AssertionError("Unknown object type");
        }
    }
View Full Code Here

Examples of net.edzard.kinetic.Circle

    stage.add(layer);
  }

  public void testCreationZOrder() {
    for (int i=0; i < 3; ++i) {
      Circle c = Kinetic.createCircle(new Vector2d(10,10), 5);
      layer.add(c);
      assertEquals(i, c.getZIndex())
    }
  } 
View Full Code Here

Examples of net.phys2d.raw.shapes.Circle

  /**
   * @see net.phys2d.raw.test.AbstractDemo#init(net.phys2d.raw.World)
   */
  protected void init(World world) {
    // world.setGravity(0, 0);
    final Body b1 = new Body(new Circle(5), Body.INFINITE_MASS);
    b1.setPosition(100, 50);
    world.add(b1);

    final Body b2 = new Body(new Circle(5), Body.INFINITE_MASS);
    b2.setPosition(300, 250);
    world.add(b2);

    final Body b3 = new Body(new Circle(5), Body.INFINITE_MASS);
    b3.setPosition(450, 400);
    world.add(b3);

    final Body b4 = new Body(new Circle(5), Body.INFINITE_MASS);
    b4.setPosition(150, 380);
    world.add(b4);

    final Body b5 = new Body(new Circle(10), 130);
    b5.setDamping(0.1f);
    b5.setPosition(0, 350);
    world.add(b5);
    chain(b1, b2, new Vector2f(), new Vector2f(0, -5), 14, world, 0.3f);
    chain(b5, b3, new Vector2f(10, 0), new Vector2f(-5, 0), 20, world, 0f);


    final Body b6 = new Body(new Circle(5), Body.INFINITE_MASS);
    b6.setPosition(440, 50);
    world.add(b6);

    final Body b7 = new Body(new Circle(5), Body.INFINITE_MASS);
    b7.setPosition(440, 340);
    world.add(b7);

    chain(b6, b7, new Vector2f(), new Vector2f(), 15, world,
        (float) Math.PI / 2f);
   
    for (int i = 0; i < 30; i++) {
      final Body b = new Body(new Circle(10), 10);
      b.setPosition(110, -i * 30-50);
      world.add(b);
    }
    //world.setGravity(0, 100);
  }
View Full Code Here

Examples of net.phys2d.raw.shapes.Circle

    world.add(body1a);
    Body body1b = new StaticBody("Ground1", new Box(20.0f, 400.0f));
    body1b.setPosition(20.0f, 200);
    world.add(body1b);
   
    Body body2 = new Body("Mover1", new Circle(25), 100.0f);
    body2.setPosition(300.0f, 4.0f);
    world.add(body2);
    //Body body3 = new Body("Mover2", new Box(25,25), 10.0f);
    Body body3 = new Body("Mover2", new Circle(25), 10.0f);
    body3.setRotation(0.3f);
    body3.setPosition(380.0f, 100.0f);
    world.add(body3);
  }
View Full Code Here

Examples of net.phys2d.raw.shapes.Circle

    world.add(body1);
    Body body1b = new StaticBody("Ground1", new Box(20.0f, 400.0f));
    body1b.setPosition(20.0f, 200);
    world.add(body1b);

    Body body3 = new Body("Mover2", new Circle(25), 50.0f);
    body3.setPosition(225.0f, 365);
    world.add(body3);
    Body body2 = new Body("Mover1", new Circle(25), 50.0f);
    body2.setPosition(275.0f, 365);
    world.add(body2);
    Body body3a = new Body("Mover2", new Circle(25), 50.0f);
    body3a.setPosition(175.0f, 365);
    world.add(body3a);
    Body body2a = new Body("Mover1", new Circle(25), 50.0f);
    body2a.setPosition(325.0f, 365);
    world.add(body2a);
   
    Body faller = new Body("Faller", new Circle(25), 200.0f);
    faller.setPosition(250.0f, -20f);
    world.add(faller);
  }
View Full Code Here

Examples of net.phys2d.raw.shapes.Circle

 
  /**
   * @see net.phys2d.raw.test.AbstractDemo#init(net.phys2d.raw.World)
   */
  protected void init(World world) {
    Body knot = new StaticBody(new Circle(10));
    knot.setPosition(100,400);
    knot.setRotation(0.5f);
    world.add(knot);
    int N=8;
    Body balls[] = new Body[N];
    for(int i=0;i<N;i++){
      Body ball = new Body(new Circle(5),10);
      ball.setPosition(100,400-(i+1)*50);
      ball.setDamping(0.01f);
      world.add(ball);
      balls[i]=ball;
    }
   
    for(int i=0;i<N;i++){
      if(i==0){
        SpringyAngleJoint saj1 = new SpringyAngleJoint(knot,balls[i],new Vector2f(),new Vector2f(),1e6f,-(float)Math.PI/2.0f-0.15f);
        SpringyAngleJoint saj2 = new SpringyAngleJoint(balls[i],knot,new Vector2f(),new Vector2f(),1e6f,(float)Math.PI/2.0f);
        //DistantConstraint daj = new DistantConstraint(knot,balls[i],new Vector2f(),new Vector2f(),50);
        SpringJoint daj = new SpringJoint(knot,balls[i],new Vector2f(100,400),new Vector2f(balls[i].getPosition()));
        daj.setCompressedSpringConst(100);
        daj.setStretchedSpringConst(100);
        daj.setSpringSize(30);
        world.add(daj);
        world.add(saj1);
        world.add(saj2);
      }else{
        SpringyAngleJoint saj1 = new SpringyAngleJoint(balls[i-1],balls[i],new Vector2f(),new Vector2f(),1e6f,-(float)Math.PI/2.0f);
        SpringyAngleJoint saj2 = new SpringyAngleJoint(balls[i],balls[i-1],new Vector2f(),new Vector2f(),1e6f,(float)Math.PI/2.0f);
        //DistantConstraint daj = new DistantConstraint(balls[i-1],balls[i],new Vector2f(),new Vector2f(),50);
        SpringJoint daj = new SpringJoint(balls[i-1],balls[i],new Vector2f(balls[i-1].getPosition()),new Vector2f(balls[i].getPosition()));
        daj.setCompressedSpringConst(100);
        daj.setStretchedSpringConst(100);
        daj.setSpringSize(50);
        world.add(daj);
        world.add(saj1);
        world.add(saj2);
      }
    }
    Body balls1[] = new Body[N];
    for(int i=0;i<N;i++){
      Body ball = new Body(new Circle(5),10);
      ball.setPosition(100,400-(i+1)*50);
      ball.setDamping(0.01f);
      world.add(ball);
      balls1[i]=ball;
    }
 
View Full Code Here

Examples of net.phys2d.raw.shapes.Circle

   * @see net.phys2d.raw.test.AbstractDemo#init(net.phys2d.raw.World)
   */
  protected void init(World world) {
    world.setGravity(0,0);
   
    circle1 = new Body("Circle 1", new Circle(20.0f), 1);
    circle1.setPosition(150,100);
    circle1.setRestitution(1.0f);
    circle1.setFriction(0.0f);
    circle1.adjustVelocity(new Vector2f(100,0));
    world.add(circle1);
    circle2 = new Body("Circle 2", new Circle(20.0f), 1);
    circle2.setPosition(250,100);
    circle2.setRestitution(1.0f);
    circle2.setFriction(0.0f);
    world.add(circle2);
  }
View Full Code Here

Examples of net.phys2d.raw.shapes.Circle

   */
  protected void keyHit(char c) {
    super.keyHit(c);
   
    if (c == ' ') {
      Body body2 = new Body("Mover1", new Circle(20), 300.0f);
      body2.setPosition(-50, (float) (((Math.random() * 50) + 150)));
      world.add(body2);
      body2.adjustAngularVelocity(1);
      body2.adjustVelocity(new Vector2f(200,(float) (Math.random() * 200)));
    }
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.