当前位置: 首页>>代码示例>>Java>>正文


Java Point3D类代码示例

本文整理汇总了Java中javafx.geometry.Point3D的典型用法代码示例。如果您正苦于以下问题:Java Point3D类的具体用法?Java Point3D怎么用?Java Point3D使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Point3D类属于javafx.geometry包,在下文中一共展示了Point3D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateAndRotatoNodes

import javafx.geometry.Point3D; //导入依赖的package包/类
private void calculateAndRotatoNodes(List<Node> nodes, double alp, double bet, double gam) {
    double A11 = Math.cos(alp) * Math.cos(gam);
    double A12 = Math.cos(bet) * Math.sin(alp) + Math.cos(alp) * Math.sin(bet) * Math.sin(gam);
    double A13 = Math.sin(alp) * Math.sin(bet) - Math.cos(alp) * Math.cos(bet) * Math.sin(gam);
    double A21 = -Math.cos(gam) * Math.sin(alp);
    double A22 = Math.cos(alp) * Math.cos(bet) - Math.sin(alp) * Math.sin(bet) * Math.sin(gam);
    double A23 = Math.cos(alp) * Math.sin(bet) + Math.cos(bet) * Math.sin(alp) * Math.sin(gam);
    double A31 = Math.sin(gam);
    double A32 = -Math.cos(gam) * Math.sin(bet);
    double A33 = Math.cos(bet) * Math.cos(gam);

    double d = Math.acos((A11 + A22 + A33 - 1d) / 2d);
    if (!ObjectUtils.equalsDoublePrecision(d, 0.0)) {
        double den = 2d * Math.sin(d);
        Point3D p = new Point3D((A32 - A23) / den, (A13 - A31) / den, (A21 - A12) / den);
        for (Node node : nodes) {
            node.setRotationAxis(p);
            node.setRotate(Math.toDegrees(d));
        }
    }
}
 
开发者ID:adihubba,项目名称:javafx-3d-surface-chart,代码行数:22,代码来源:Mesh3DChartPanel.java

示例2: GoogleTrendChartEvent

import javafx.geometry.Point3D; //导入依赖的package包/类
/**
 * @param source
 * @param target
 * @param eventType
 * @param x
 * @param y
 * @param screenX
 * @param screenY
 * @param pickResult
 * @param clickCount
 * @param contents
 */
public GoogleTrendChartEvent(Object source, EventTarget target, EventType<? extends GoogleTrendChartEvent> eventType, double x,
		double y, double screenX, double screenY, PickResult pickResult, int clickCount, List<Node> contents) {
	super(source, target, eventType);
	this.x = x;
	this.y = y;
	this.screenX = screenX;
	this.screenY = screenY;
	this.sceneX = x;
	this.sceneY = y;
	this.pickResult = pickResult != null ? pickResult : new PickResult(target, x, y);
	final Point3D p = InputEventUtils.recomputeCoordinates(this.pickResult, null);
	this.x = p.getX();
	this.y = p.getY();
	this.z = p.getZ();
	this.clickCount = clickCount;
	this.contents = contents;
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:30,代码来源:GoogleTrendChartEvent.java

示例3: DockEvent

import javafx.geometry.Point3D; //导入依赖的package包/类
/**
 * Constructs new DockEvent event..
 * 
 * @param source the source of the event. Can be null.
 * @param target the target of the event. Can be null.
 * @param eventType The type of the event.
 * @param x The x with respect to the source. Should be in scene coordinates if source == null or
 *        source is not a Node.
 * @param y The y with respect to the source. Should be in scene coordinates if source == null or
 *        source is not a Node.
 * @param screenX The x coordinate relative to screen.
 * @param screenY The y coordinate relative to screen.
 * @param pickResult pick result. Can be null, in this case a 2D pick result without any further
 *        values is constructed based on the scene coordinates
 * @param contents The contents being dragged during this event.
 */
public DockEvent(Object source, EventTarget target, EventType<? extends DockEvent> eventType,
    double x, double y, double screenX, double screenY, PickResult pickResult, Node contents) {
  super(source, target, eventType);
  this.x = x;
  this.y = y;
  this.screenX = screenX;
  this.screenY = screenY;
  this.sceneX = x;
  this.sceneY = y;
  this.pickResult = pickResult != null ? pickResult : new PickResult(target, x, y);
  final Point3D p = InputEventUtils.recomputeCoordinates(this.pickResult, null);
  this.x = p.getX();
  this.y = p.getY();
  this.z = p.getZ();
  this.contents = contents;
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:33,代码来源:DockEvent.java

示例4: spreadAllCards

import javafx.geometry.Point3D; //导入依赖的package包/类
/**
 * This method is called by @update if the update type is @SPREAD_CARDS
 * It spreads the card of a group on the table
 * @since v0.7.1
 * @param   cardUpdate     the cardUpdate object.
 */
private void spreadAllCards(CardUpdate cardUpdate) throws NullViewCardException {
    int nbCardInRow = (int)(( CARPET_SIZE - MARGIN_TABLE*2)/(ViewCard.getWidth()+MARGIN_CARDS));
    int i = 0;
    int j = 0;
    for(Card card : cardUpdate.getCardGroup()) {
        Point3D position = new Point3D(MARGIN_TABLE + i*(MARGIN_CARDS+ViewCard.getWidth()), MARGIN_TABLE
                + j*(MARGIN_CARDS+ViewCard.getHeight()), -ViewCard.getDepth());
        CardUpdate newCardUpdate = new CardUpdate(CardUpdateType.MOVE_CARD_BETWEEN_GROUPS, card, null);
        cardUpdate.addSubUpdate(newCardUpdate);
        changeCardGroup(newCardUpdate, position, 1000);
        i++;
        if (i>nbCardInRow-1)
        {
            i=0;
            j++;
        }
    }
    cardUpdate.setAnimationFinished();
}
 
开发者ID:Bokoblin,项目名称:DUTS3-CPOA-ProjetTarot,代码行数:26,代码来源:GameView.java

示例5: moveCamera

import javafx.geometry.Point3D; //导入依赖的package包/类
/**
 * Moves the camera
 * @since v0.2
 *
 * @param position the new camera position
 * @param rotation the new camera rotation
 * @param transitionTime the transition length to new camera position and rotation
 */
public void moveCamera(Point3D position, double rotation, int transitionTime)
{
    if (getTranslateX() != position.getX() || getTranslateY() != position.getY() || getTranslateZ() != position.getZ() || rotation != getRotate())
    {
        if (transitionTime < 1)
        {
            transitionTime = 1;
        }
        Timeline timeline = new Timeline();
        timeline.getKeyFrames().addAll(
                new KeyFrame(new Duration(transitionTime), new KeyValue(translateXProperty(), position.getX())),
                new KeyFrame(new Duration(transitionTime), new KeyValue(translateYProperty(), position.getY())),
                new KeyFrame(new Duration(transitionTime), new KeyValue(translateZProperty(), position.getZ())),
                new KeyFrame(new Duration(transitionTime), new KeyValue(rotateProperty(), rotation))
        );
        timeline.play();
    }
}
 
开发者ID:Bokoblin,项目名称:DUTS3-CPOA-ProjetTarot,代码行数:27,代码来源:ViewCamera.java

示例6: valuesTest

import javafx.geometry.Point3D; //导入依赖的package包/类
/**
     * Test Check that Intersected Points is correct in not extremum points.
     */
    @Test(timeout = 20000)
    public void valuesTest() {
        eps = 0.1;
        Rectangle rect = getAppRectangle();
        int leftX = getLeftX() + rect.x;
        int topY = getTopY() + rect.y;
        int delta = getDelta();
        int iterations = getIterations();

        final double miniDelta = ((double) delta) / ((double) iterations);
        Point3D points[] = new Point3D[iterations * 4];
        fillPathPointsArray(leftX, topY, miniDelta, 0D, points, 0, iterations);
        fillPathPointsArray(leftX + delta, topY, 0D, miniDelta, points, iterations, iterations);
        fillPathPointsArray(leftX + delta, topY + delta, -miniDelta, 0D, points, 2 * iterations, iterations);
        fillPathPointsArray(leftX, topY + delta, 0D, -miniDelta, points, 3 * iterations, iterations);
        for (int i = 0; i < 4 * iterations; i++) {
            double z = points[i].getZ();
            double expected = Math.sin(Math.PI / 2 + Math.PI / ((double) iterations) * (double) i);
//            System.out.println(expected + "  " + z);
            Assert.assertTrue("Expected " + expected + ", but was " + z, Math.abs(z - expected) < eps);
        }
    }
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:26,代码来源:MeshPickingTests.java

示例7: drawNode

import javafx.geometry.Point3D; //导入依赖的package包/类
@Override
public Node drawNode() {
    currentTestNode = this;
    RotateTransition transition = new RotateTransition();
    Pane p = pre(transition);

    transition.setDuration(Duration.millis(typicalDuration));
    transition.setNode(circle);

    circle.setRotate(dFrom);
    transition.setFromAngle(dFrom);
    transition.setByAngle(dBy);

    transition.setCycleCount(1);
    transition.setAutoReverse(true);

    Point3D p3d = new Point3D(0,0,100);
    transition.setAxis(p3d);
    if (!p3d.equals(transition.getAxis()))  {
        reportGetterFailure("TransitionRotate.getAxis()");
    }

    return p;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:25,代码来源:AnimationTransitionApp.java

示例8: getRightRotation

import javafx.geometry.Point3D; //导入依赖的package包/类
public static String getRightRotation(Point3D p, String selFaces){
        double radius = p.magnitude();
        double angle = Math.atan2(p.getY(), p.getX());
        String face="";
        if (radius >= RAD_MINIMUM && selFaces.contains("-") && selFaces.split("-").length == 2) {
            String[] faces = selFaces.split("-");
            // select rotation if p.getX>p.getY
            if (-Math.PI / 4d <= angle && angle < Math.PI / 4d ){ // X
                face = faces[0];
            } else if (Math.PI / 4d <= angle && angle < 3d * Math.PI / 4d) { // Y
                face = faces[1];
            } else if ((3d * Math.PI / 4d <= angle && angle <= Math.PI) || 
                      (-Math.PI <= angle && angle < -3d * Math.PI / 4d)) { // -X
                face = reverseRotation(faces[0]);
            } else { //-Y
                face = reverseRotation(faces[1]);
            }
//            System.out.println("face: "+face);
        } else if (!face.isEmpty() && radius < RAD_MINIMUM) { // reset previous face
            face = "";
        }
        return face;
    }
 
开发者ID:gluonhq,项目名称:gluon-samples,代码行数:24,代码来源:Utils.java

示例9: matrixRotateNode0

import javafx.geometry.Point3D; //导入依赖的package包/类
protected void matrixRotateNode0(Node n, double alf, double bet, double gam){
    double A11=Math.cos(alf)*Math.cos(gam);
    double A12=Math.cos(bet)*Math.sin(alf)+Math.cos(alf)*Math.sin(bet)*Math.sin(gam);
    double A13=Math.sin(alf)*Math.sin(bet)-Math.cos(alf)*Math.cos(bet)*Math.sin(gam);
    double A21=-Math.cos(gam)*Math.sin(alf);
    double A22=Math.cos(alf)*Math.cos(bet)-Math.sin(alf)*Math.sin(bet)*Math.sin(gam);
    double A23=Math.cos(alf)*Math.sin(bet)+Math.cos(bet)*Math.sin(alf)*Math.sin(gam);
    double A31=Math.sin(gam);
    double A32=-Math.cos(gam)*Math.sin(bet);
    double A33=Math.cos(bet)*Math.cos(gam);

    double d = Math.acos((A11+A22+A33-1d)/2d);
    if(d!=0d){
        double den=2d*Math.sin(d);
        Point3D p= new Point3D((A32-A23)/den,(A13-A31)/den,(A21-A12)/den);
        n.setRotationAxis(p);
        n.setRotate(Math.toDegrees(d));                    
    }
}
 
开发者ID:sanke69,项目名称:fr.xs.jtk,代码行数:20,代码来源:Quaternion.java

示例10: make3DLine

import javafx.geometry.Point3D; //导入依赖的package包/类
/**
 * Make a 3D Line for this OffRosettePoint.
 *
 * @return 3D Line
 */
Line3D make3DLine() {
  Line3D line = new Line3D();

  Vector2d offset = offsetFromParent();
  double x0 = offset.x;		// point where cutter contacts the surface
  double y0 = getY();     // (y should always be zero)		
  double z0 = offset.y;

  for (int i = 0; i < (NUM_3D_PTS + 1); i++) {
    double angDeg = (double) i * 360.0 / (double) NUM_3D_PTS;	// in degrees
    double angRad = Math.toRadians(angDeg);
    Vector2d xz = rosetteMove(angDeg, x0, z0);   // xz location due to rosette motion
    double r = Math.hypot(xz.x, y0);		// cylindrical radius  NOTE: y should always be 0.0
    if (cutter.getLocation().isBack()) {	// if in back, add 180 degrees rotation
      angRad += Math.PI;
    }
    line.add(new Point3D(r * Math.cos(-angRad), r * Math.sin(-angRad), xz.y));
  }
  return line;
}
 
开发者ID:billooms,项目名称:COrnLathe,代码行数:26,代码来源:OffRosettePoint.java

示例11: makeCleanSurface

import javafx.geometry.Point3D; //导入依赖的package包/类
/**
 * Make a clean new surface from the outline.
 *
 * @return array of Point3D[][]
 */
public synchronized Point3D[][] makeCleanSurface() {
  Point2D.Double[] curvePts;
  if (inOut) {
    curvePts = outline.getInsideCurve().getPoints();
  } else {
    curvePts = outline.getOutsideCurve().getPoints();
  }
  Point3D[][] newPts = new Point3D[curvePts.length][DEFAULT_SECTORS];
  for (int i = 0; i < curvePts.length; i++) {
    Point2D.Double pt = curvePts[i];
    for (int j = 0; j < DEFAULT_SECTORS; j++) {
      double angleRad = -TWOPI * (double) j / DEFAULT_SECTORS;    // minus to match rotation of lathe
      // convert 2D outline point to a point in 3D lathe space
      // use abs(x) in case of -x so that surface always starts the right place
      newPts[i][j] = new Point3D(
          Math.abs(pt.x) * Math.cos(angleRad),
          Math.abs(pt.x) * Math.sin(angleRad),
          pt.y);
    }
  }
  return newPts;
}
 
开发者ID:billooms,项目名称:COrnLathe,代码行数:28,代码来源:Surface.java

示例12: makePatternTwist

import javafx.geometry.Point3D; //导入依赖的package包/类
/**
 * Make an array of additional twist in degrees made by the PatternBar from
 * the given SurfaceTwist.
 *
 * @param tw SurfaceTwist
 * @return additional twist in degrees for each point.
 */
private double[] makePatternTwist(Point3D[] tw) {
  PatternBar pb = ((LinePoint) beginPt).getPatternBar();
  double startR = beginPt.getX();
  double[] addTwist = new double[tw.length];
  double dist = 0.0;		// cummulative distance along tw
  if (scaleAmplitude) {
    addTwist[0] = degreesForD(pb.getAmplitudeAt(dist) * tw[0].getX()/startR, tw[0].getX());	// reminder: tw[].x is radius in lathe coords
  } else {
    addTwist[0] = degreesForD(pb.getAmplitudeAt(dist), tw[0].getX());	// reminder: tw[].x is radius in lathe coords
  }
  for (int i = 1; i < tw.length; i++) {
    dist += distance(tw[i - 1], tw[i]);
    if (scaleAmplitude) {
      addTwist[i] = degreesForD(pb.getAmplitudeAt(dist) * tw[i].getX()/startR, tw[i].getX());
    } else {
      addTwist[i] = degreesForD(pb.getAmplitudeAt(dist), tw[i].getX());
    }
  }
  return addTwist;
}
 
开发者ID:billooms,项目名称:COrnLathe,代码行数:28,代码来源:SpiralLine.java

示例13: getCutterTwist

import javafx.geometry.Point3D; //导入依赖的package包/类
/**
 * Get an array of numbers representing the twist at each point on the cut
 * surface reflected back to the nearest points on the cutter curve. 
 * The points are different that the points on the CutterCurve because they
 * are based on a finer resolution than the curve resolution.
 * Note: Twist starts at zero, so the twist is relative. You must add the phase of
 * the initial point to these numbers!
 *
 * @return an array of Point3d with x,y from the original pts and z=twist in
 * degrees (or null if there are no points given). Note: In lathe coordinates,
 * this is actually radius, z, c(degrees).
 */
public Point3D[] getCutterTwist() {
  // first find points on the surface (cutCurve)
  Point3D[] rzc = getSurfaceTwist();
  if (rzc == null) {
    return null;
  }
  switch (cutter.getFrame()) {
    case Fixed:
    case Drill:
    case ECF:
      return rzc;     // for Drill adn ECF the cut path is on the surface
  }

  // use a much finer resolution cutterPathCurve for smoothness
  Curve fineCut = outline.getCutterPathCurve(cutter);
  fineCut.reSample(outline.getResolution() / 10.0);

  // then look for the closest point on the fine resolution cut curve
  Point3D[] newPts = new Point3D[rzc.length];
  for (int i = 0; i < rzc.length; i++) {
    Point2D.Double near = fineCut.nearestPoint(new Point2D.Double(rzc[i].getX(), rzc[i].getY()));
    newPts[i] = new Point3D(near.x, near.y, rzc[i].getZ());
  }
  return newPts;
}
 
开发者ID:billooms,项目名称:COrnLathe,代码行数:38,代码来源:SpiralCut.java

示例14: make3DLines

import javafx.geometry.Point3D; //导入依赖的package包/类
/**
 * Make the 3D Lines for this LinePoint. Use this instead of make3DLines().
 *
 * @param xyz list of unrotated points in x, y, z space
 */
void make3DLines(ArrayList<Point3D> xyz) {
  list3D.clear();
  String fullMask = mask;
  if (!fullMask.isEmpty()) {
    while (fullMask.length() < repeat) {
      fullMask += mask;	// fill out to full length
    }
  }
  double ang = phase / repeat;
  for (int i = 0; i < repeat; i++) {
    if (mask.isEmpty() || (fullMask.charAt(i) != '0')) {
      Line3D line = new Line3D(xyz);
      line.rotate(RotMatrix.Axis.Z, ang);
      list3D.add(line);
    }
    ang -= 360.0 / (double) repeat;
  }
}
 
开发者ID:billooms,项目名称:COrnLathe,代码行数:24,代码来源:LinePoint.java

示例15: getPointsForGauss

import javafx.geometry.Point3D; //导入依赖的package包/类
private List<Point3D> getPointsForGauss() {
    List<Point3D> result = new ArrayList<Point3D>();
    for (double x = -3.0; x <= 3.0; x = x + 0.20) {
        for (double y = -3.0; y <= 3.0; y = y + 0.20) {
            result.add(new Point3D(x, calculatePDF(x, y), y));
        }
    }
    return result;
}
 
开发者ID:adihubba,项目名称:javafx-3d-surface-chart,代码行数:10,代码来源:StarterFrame.java


注:本文中的javafx.geometry.Point3D类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。