Package javax.vecmath

Examples of javax.vecmath.Point2d


    this.notifyObservers(SimulatorObserverCommandState.STOPPED_SIMULATION);

  }

  private void calculateOutOfWindowAreaPosition(RoboterController roboterController, RoboterMove rm) {
    Point2d newPosition = null;

    // Fall 1: Unten
    Point2d roboter1 = rm.getNewRoboterPoint();
    if (roboter1.getY() > height) {
      newPosition = getIntersectionPointForSides(rm, roboter1, SideStraigtLine.LINE_LEFT, SideStraigtLine.LINE_RIGHT,
          SideStraigtLine.LINE_UP);
      roboterController.getRoboter().setX(newPosition.getX());
      roboterController.getRoboter().setY(newPosition.getY());

      // Fall 2: Oben
    } else if (roboter1.getY() < 0) {
      newPosition = getIntersectionPointForSides(rm, roboter1, SideStraigtLine.LINE_LEFT, SideStraigtLine.LINE_RIGHT,
          SideStraigtLine.LINE_DOWN);
      roboterController.getRoboter().setX(newPosition.getX());
      roboterController.getRoboter().setY(newPosition.getY());

      // Fall 3: Rechts
    } else if (roboter1.getX() > width) {
      newPosition = getIntersectionPointForSides(rm, roboter1, SideStraigtLine.LINE_LEFT, SideStraigtLine.LINE_DOWN,
          SideStraigtLine.LINE_UP);
      roboterController.getRoboter().setX(newPosition.getX());
      roboterController.getRoboter().setY(newPosition.getY());

      // Fall 4: Links
    } else if (roboter1.getX() < 0) {
      newPosition = getIntersectionPointForSides(rm, roboter1, SideStraigtLine.LINE_RIGHT, SideStraigtLine.LINE_DOWN,
          SideStraigtLine.LINE_UP);
      roboterController.getRoboter().setX(newPosition.getX());
      roboterController.getRoboter().setY(newPosition.getY());
View Full Code Here


  }

  private Point2d getIntersectionPointForSides(RoboterMove rm, Point2d roboter1, SideStraigtLine... lines) {
    for (SideStraigtLine line : lines) {
      try {
        Point2d p1 = getIntersectionPointForSide(rm, roboter1, line);
        if (isPointWithinField(p1)) {
          // System.out.println("Found Intersection on Side: " +
          // line);
          return p1;
        } else {
View Full Code Here

    // double s = solution.getEntry(1);

    double res1 = roboter1.getX() + direction.getX() * r;
    double res2 = roboter1.getY() + direction.getY() * r;

    Point2d p = new Point2d(res1, res2);
    return p;
  }
View Full Code Here

            Vector3d place = bombPhysicalObject.getPlace();
            setTranslateX(place.getX());
            setTranslateY(place.getY());

            Point2d planePoint= new Point2d(world.getPlane().getTranslateX(), world.getPlane().getTranslateY());
            if(isTouching(planePoint)){
                switchToExploding();
            }
            if(getTranslateY()>1000){
                switchToReady();
View Full Code Here

        getChildren().clear();
        getChildren().addAll(circle, imageView);
    }
   
    private boolean isTouching(Point2d p){
        Point2d center= new Point2d(getTranslateX(), getTranslateY());      
        double dx= p.x-center.x;
        double dy= p.y-center.y;
        double distance= Math.sqrt(dx*dx + dy*dy);
        return distance<50;
    }
View Full Code Here

    }

  public IControllable AddObject(double posX, double posY, double mass, IEventCallback cb) {
        FysixObject newObj = new FysixObject();
        newObj.setMass(mass);
        newObj.setPosition(new Point2d(posX, posY));
        newObj.registerEventCallback(cb);
        fWorld.addObject(newObj);
        return newObj;
    }
View Full Code Here

        levelPoly01.addPoint( 900,3000);
        levelPoly01.addPoint( 900,2400);
        levelPoly01.addPoint(1200,1800);
        levelPoly01.addPoint(1200,1200);
       
        Point2d viewCoordUL = new Point2d();
        viewCoordUL.x = fo1.getPosition().x;
        viewCoordUL.y = fo1.getPosition().y;
       
        Dimension frameSize = r.getSize();
       
View Full Code Here

    }

    if(mol == null && request.getParameter("element") != null && (request.getParameter("element").length() > 0)) {
      String elemSymbol = request.getParameter("element");
      Atom a = new Atom(elemSymbol);
      a.setPoint2d(new Point2d(0.0, 0.0));
      mol = new Molecule();
      mol.addAtom(a);
      makeStructure = false;
    }
   
View Full Code Here

    return this.isSteering ? getMaxAngularAcceleration() : getMaxAngularSpeed();
  }

  @Override
  public Status live() {
    Point2d position = new Point2d(getX(), getY());
    Vector2d orientation = getDirection();
    double linearSpeed = getCurrentLinearSpeed();
    double angularSpeed = getCurrentAngularSpeed();
   
    BehaviourOutput output = null;

    List<Perception> perceptions = getPerceivedObjects();

    if (this.seekBehaviour!=null && !perceptions.isEmpty()) {

      Perception percept = perceptions.get(0);

      if (percept.getPerceivedObject() instanceof MouseTarget) {
        Point2d target = new Point2d(percept.getPerceivedObject().getPosition());

        // run the seek behaviour
        output = this.seekBehaviour.runSeek(position, linearSpeed, getMaxLinear(), target);
      }
      else {
View Full Code Here

   */
  public SteeringBehaviourOutput runWander(Point2d position, Vector2d orientation, double linearSpeed, double maxLinearAcc, double angularSpeed, double maxAngularAcc) {
    Vector2d circleDirection = new Vector2d(orientation);
    circleDirection.scale(this.circleDistance);
   
    Point2d circleCenter = new Point2d();
    circleCenter.add(position, circleDirection);

    double deltaAngle = (Math.random() - Math.random()) * this.maxRotation;
    this.rotation = GeometryUtil.clamp(this.rotation+deltaAngle, -Math.PI, Math.PI);
   
    Vector2d targetDirection = new Vector2d(orientation);
    targetDirection.normalize();
    targetDirection.scale(this.circleRadius);
    GeometryUtil.turnVector(targetDirection, this.rotation);
   
    Point2d faceTarget = new Point2d();
    faceTarget.add(circleCenter, targetDirection);
       
    SteeringBehaviourOutput output = this.faceBehaviour.runFace(position, orientation, angularSpeed, maxAngularAcc, faceTarget);
   
    if (output==null) output = new SteeringBehaviourOutput();
   
View Full Code Here

TOP

Related Classes of javax.vecmath.Point2d

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.