本文整理汇总了Java中javafx.geometry.Point3D.getX方法的典型用法代码示例。如果您正苦于以下问题:Java Point3D.getX方法的具体用法?Java Point3D.getX怎么用?Java Point3D.getX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.geometry.Point3D
的用法示例。
在下文中一共展示了Point3D.getX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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();
}
}
示例4: calculateZValueInTriangle
import javafx.geometry.Point3D; //导入方法依赖的package包/类
/**
* Calculates the z value of an given 3d triangle and a 2d point, where x and y coordinates are in this triangle
* http://math.stackexchange.com/a/851752
*/
public static double calculateZValueInTriangle(Point2D p, Point3D p0, Point3D p1, Point3D p2) {
double divider = ((p1.getX() - p0.getX()) * (p2.getY() - p0.getY())) - ((p2.getX() - p0.getX()) * (p1.getY() - p0.getY()));
double z = p0.getZ() + (((((p1.getX() - p0.getX()) * (p2.getZ() - p0.getZ())) - ((p2.getX() - p0.getX()) * (p1.getZ() - p0.getZ()))) / divider) * (p.getY() - p0.getY()))
- (((((p1.getY() - p0.getY()) * (p2.getZ() - p0.getZ())) - ((p2.getY() - p0.getY()) * (p1.getZ() - p0.getZ()))) / divider) * (p.getX() - p0.getX()));
return z;
}
示例5: calculateYValueInTriangle
import javafx.geometry.Point3D; //导入方法依赖的package包/类
/**
* Calculates the y value of an given 3d triangle and a 2d point, where x and z coordinates are in this triangle
*/
public static double calculateYValueInTriangle(Point2D p, Point3D p0, Point3D p1, Point3D p2) {
double divider = ((p1.getZ() - p0.getZ()) * (p2.getX() - p0.getX())) - ((p1.getX() - p0.getX()) * (p2.getZ() - p0.getZ()));
double y = p0.getY() + (((((p1.getY() - p0.getY()) * (p2.getX() - p0.getX())) - ((p1.getX() - p0.getX()) * (p2.getY() - p0.getY()))) / divider) * (p.getY() - p0.getZ()))
- (((((p1.getY() - p0.getY()) * (p2.getZ() - p0.getZ())) - ((p2.getY() - p0.getY()) * (p1.getZ() - p0.getZ()))) / divider) * (p.getX() - p0.getX()));
return y;
}
示例6: isPointInTriangle
import javafx.geometry.Point3D; //导入方法依赖的package包/类
/**
* method returns true, if point p is in the triangle. Method uses barycentric coordinate system.
* https://stackoverflow.com/questions/2049582/how-to-determine-a-point-in-a-triangle
*/
public static boolean isPointInTriangle(Point2D p, Point3D p0, Point3D p1, Point3D p2) {
double area = 0.5 * (-p1.getZ() * p2.getX() + p0.getZ() * (-p1.getX() + p2.getX()) + p0.getX() * (p1.getZ() - p2.getZ()) + p1.getX() * p2.getZ());
int sign = area < 0.0 ? -1 : 1;
double s = (p0.getZ() * p2.getX() - p0.getX() * p2.getZ() + (p2.getZ() - p0.getZ()) * p.getX() + (p0.getX() - p2.getX()) * p.getY()) * sign;
double t = (p0.getX() * p1.getZ() - p0.getZ() * p1.getX() + (p0.getZ() - p1.getZ()) * p.getX() + (p1.getX() - p0.getX()) * p.getY()) * sign;
return s > 0.0 && t > 0.0 && (s + t) < 2.0 * area * sign;
}
示例7: MeshCalculationComposite
import javafx.geometry.Point3D; //导入方法依赖的package包/类
private MeshCalculationComposite(List<Point3D> dataPoints, int size) {
this.dataPoints = dataPoints;
this.size = size;
for (Point3D point3d : dataPoints) {
minX = Math.min(minX, point3d.getX());
maxX = Math.max(maxX, point3d.getX());
minY = Math.min(minY, point3d.getY());
maxY = Math.max(maxY, point3d.getY());
minZ = Math.min(minZ, point3d.getZ());
maxZ = Math.max(maxZ, point3d.getZ());
}
sizeX = maxX - minX;
sizeY = maxY - minY;
sizeZ = maxZ - minZ;
// normalize points according to coordinate system size
normalizedPoints = new ArrayList<Point3D>(dataPoints.size());
for (Point3D point : dataPoints) {
double x = (point.getX() - minX) / sizeX * size;
double y = (point.getY() - minY) / sizeY * size;
double z = (point.getZ() - minZ) / sizeZ * size;
normalizedPoints.add(new Point3D(x, y, z));
}
triangle3DList = new ArrayList<Triangle3D>(dataPoints.size() / 2);
}
示例8: apply
import javafx.geometry.Point3D; //导入方法依赖的package包/类
/**
* Apply this rotation matrix to the given point.
*
* @param p Point
* @return Rotated point
*/
public Point3D apply(Point3D p) {
final double x = p.getX();
final double y = p.getY();
final double z = p.getZ();
return new Point3D(x * m[0][0] + y * m[0][1] + z * m[0][2],
x * m[1][0] + y * m[1][1] + z * m[1][2],
x * m[2][0] + y * m[2][1] + z * m[2][2]);
}
示例9: convertPoint3d4Delauney
import javafx.geometry.Point3D; //导入方法依赖的package包/类
@Override
public Point convertPoint3d4Delauney(Point3D point) {
return new Point(point.getX(), point.getZ(), point.getY());
}
示例10: convertPoint3d4Delauney
import javafx.geometry.Point3D; //导入方法依赖的package包/类
@Override
public Point convertPoint3d4Delauney(Point3D point) {
return new Point(point.getX(), point.getY(), point.getZ());
}
示例11: getPickedRotation
import javafx.geometry.Point3D; //导入方法依赖的package包/类
public static String getPickedRotation(int cubie, MeshView mesh){
Point3D normal = getMeshNormal(mesh);
String rots = ""; // Rx-Ry
switch(cubie){
case 0: rots = (normal.getZ() > 0.99) ? "Ui-Li" : ((normal.getX() < -0.99) ? "Ui-F" : ((normal.getY() > 0.99) ? "Ui-Li" : ""));
break;
case 1: rots = (normal.getZ() > 0.99) ? "F-Mi" : ((normal.getY() > 0.99) ? "Ui-Mi" : ""); // between L and R, as L
break;
case 2: rots = (normal.getZ() > 0.99) ? "Ui-R" : ((normal.getX() > 0.99) ? "Ui-Fi" : ((normal.getY() > 0.99) ? "Ui-R" : ""));
break;
case 3: rots = (normal.getZ() > 0.99) ? "E-F" : ((normal.getX() < -0.99) ? "E-Li" : ""); // between U and D, as D
break;
case 4: rots = (normal.getZ() > 0.99) ? "Yi-X" : "";
break;
case 5: rots = (normal.getZ() > 0.99) ? "E-Fi" : ((normal.getX() > 0.99) ? "E-R" : ""); // between U and D, as D
break;
case 6: rots = (normal.getZ() > 0.99) ? "D-Li" : ((normal.getX() < -0.99) ? "D-F" : ((normal.getY() < -0.99) ? "D-Li" : ""));
break;
case 7: rots = (normal.getZ() > 0.99) ? "Fi-Mi" : ((normal.getY() < -0.99) ? "Fi-Mi" : ""); // between L and R, as L
break;
case 8: rots = (normal.getZ() > 0.99) ? "D-R" : ((normal.getX() > 0.99) ? "D-Fi" : ((normal.getY() < -0.99) ? "D-R" : ""));
break;
case 9: rots = (normal.getY() > 0.99) ? "S-U" : ((normal.getX() < -0.99) ? "L-S" : ""); // between U and D, as D
break;
case 10: rots = (normal.getY() > 0.99) ? "Z-X" : "";
break;
case 11: rots = (normal.getY() > 0.99) ? "S-Ui" : ((normal.getX() > 0.99) ? "R-Si" : ""); // between U and D, as D
break;
case 12: rots = (normal.getX() < -0.99) ? "Yi-Z" : "";
break;
case 14: rots = (normal.getX() > 0.99) ? "Yi-Zi" : "";
break;
case 15: rots = (normal.getY() < -0.99) ? "D-S" : ((normal.getX() < -0.99) ? "Li-S" : ""); // between U and D, as D
break;
case 16: rots = (normal.getY() < -0.99) ? "Zi-X" : "";
break;
case 17: rots = (normal.getY() < -0.99) ? "D-S" : ((normal.getX() > 0.99) ? "Ri-Si" : ""); // between U and D, as D
break;
case 18: rots = (normal.getZ() < -0.99) ? "Ui-L" : ((normal.getX() < -0.99) ? "Ui-Bi" : ((normal.getY() > 0.99) ? "Ui-L" : ""));
break;
case 19: rots = (normal.getZ() < -0.99) ? "B-M" : ((normal.getY() > 0.99) ? "U-M" : ""); // between L and R, as L
break;
case 20: rots = (normal.getZ() < -0.99) ? "Ui-Ri" : ((normal.getX() > 0.99) ? "Ui-B" : ((normal.getY() > 0.99) ? "Ui-Ri" : ""));
break;
case 21: rots = (normal.getZ() < -0.99) ? "E-Bi" : ((normal.getX() < -0.99) ? "E-L" : ""); // between U and D, as D
break;
case 22: rots = (normal.getZ() < -0.99) ? "Yi-Xi" : "";
break;
case 23: rots = (normal.getZ() < -0.99) ? "E-B" : ((normal.getX() > 0.99) ? "E-Ri" : ""); // between U and D, as D
break;
case 24: rots = (normal.getZ() < -0.99) ? "D-L" : ((normal.getX() < -0.99) ? "D-Bi" : ((normal.getY() < -0.99) ? "D-L" : ""));
break;
case 25: rots = (normal.getZ() < -0.99) ? "Bi-M" : ((normal.getY() < -0.99) ? "Bi-M" : ""); // between L and R, as L
break;
case 26: rots = (normal.getZ() < -0.99) ? "D-Ri" : ((normal.getX() > 0.99) ? "D-B" : ((normal.getY() < -0.99) ? "D-B" : ""));
break;
}
return rots;
}
示例12: LineTriangleMesh
import javafx.geometry.Point3D; //导入方法依赖的package包/类
/**
* The default constructor which sets up the mesh to display a line.
*
* @param start
* The line's start point.
* @param end
* The line's end point.
*/
public LineTriangleMesh(Point3D start, Point3D end) {
super();
// Get the angle between the two points
Point3D perp = start.crossProduct(end);
// Remove the y component from the vector and normalize it to length 1.
perp.add(0, -1 * perp.getY(), 0);
perp = perp.normalize();
// Get the start point's coordinates
float startX = (float) start.getX();
float startY = (float) start.getY();
float startZ = (float) start.getZ();
// Get the end point's coordinates
float endX = (float) end.getX();
float endY = (float) end.getY();
float endZ = (float) end.getZ();
// Get the perpendicular vector's x and y amounts
float perpX = (float) perp.getX();
float perpZ = (float) perp.getZ();
// If the line would have no width, instead set it to draw along the x
// axis.
if (perpX == 0 && perpZ == 0) {
perpX = 1;
}
// Set the points array. The array will form a rectangle centered along
// the line, with the perpendicular vector providing the x and z
// direction offsets to give the rectangle its width.
getPoints().addAll(new float[] { startX - perpX, startY, startZ - perpZ,
startX + perpX, startY, startZ + perpZ, endX - perpX, endY,
endZ - perpZ, endX + perpX, endY, endZ + perpZ });
// There will be no texture on the line, so add a dummy coordinate
// instead.
getTexCoords().addAll(new float[] { 0, 0 });
// Create faces for the line. There will be two triangles, which
// together will form a rectangle. Each triangle will be drawn twice,
// facing opposite directions each time, to ensure that the line is
// displayed in the proper color from both directions.
getFaces().addAll(new int[] { 0, 0, 1, 0, 2, 0, 1, 0, 0, 0, 2, 0, 1, 0,
2, 0, 3, 0, 2, 0, 1, 0, 3, 0 });
}
示例13: needsResetXAxis
import javafx.geometry.Point3D; //导入方法依赖的package包/类
private boolean needsResetXAxis(Point3D nextEdge, Point3D nextFreeOnAxis, CityNode child) {
return nextEdge.getX() - nextFreeOnAxis.getX() < child.getSize() + streetSize;
}
示例14: intersects
import javafx.geometry.Point3D; //导入方法依赖的package包/类
private boolean intersects(Point3D checkPoint, Point3D childStartPoint, double childSize) {
BoundingBox boundingBox = new BoundingBox(childStartPoint.getX(), childStartPoint.getZ(), childSize, childSize);
Point2D checkPoint2D = new Point2D(checkPoint.getX(), checkPoint.getZ());
return boundingBox.contains(checkPoint2D);
}
示例15: addDataFromNode
import javafx.geometry.Point3D; //导入方法依赖的package包/类
/**
* Extracts svg properties directly from the given Node and applies them.
*
* @param nodeProperties
* @param node
*/
protected void addDataFromNode(Node node) {
svgNodeProperties = new SvgNodeProperties();
//comment
String className = node.getClass().getName();
svgNodeProperties.addComment(className);
String comment = createCssClassString(node);
svgNodeProperties.addComment(comment);
//id
String id = node.getId();
svgNodeProperties.setId(id);
//visibility
if (node.isVisible()) {
svgNodeProperties.setVisibility(SvgVisibility.VISIBLE);
} else {
svgNodeProperties.setVisibility(SvgVisibility.HIDDEN);
}
//opacity
Double opacity = node.getOpacity();
svgNodeProperties.setOpacity(opacity);
Bounds bounds = node.getBoundsInParent();
//x
Double x = bounds.getMinX();
svgNodeProperties.setX(x);
//y
Double y = bounds.getMinY();
svgNodeProperties.setY(y);
//x scale
Double xScale = node.getScaleX();
svgNodeProperties.setXScale(xScale);
//y scale
Double yScale = node.getScaleY();
svgNodeProperties.setYScale(yScale);
//rotation
Double rotation = node.getRotate();
svgNodeProperties.setRotation(rotation);
//rotation axis
Point3D rotationAxis = node.getRotationAxis();
Double rotationAxisX = rotationAxis.getX();
svgNodeProperties.setRotationAxisX(rotationAxisX);
Double rotationAxisY = rotationAxis.getY();
svgNodeProperties.setRotationAxisY(rotationAxisY);
}