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));
}
}
}
java类javafx.geometry.Point3D的实例源码
Mesh3DChartPanel.java 文件源码
项目:javafx-3d-surface-chart
阅读 31
收藏 0
点赞 0
评论 0
GoogleTrendChartEvent.java 文件源码
项目:Gargoyle
阅读 45
收藏 0
点赞 0
评论 0
/**
* @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;
}
DockEvent.java 文件源码
项目:Gargoyle
阅读 31
收藏 0
点赞 0
评论 0
/**
* 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;
}
GameView.java 文件源码
项目:DUTS3-CPOA-ProjetTarot
阅读 52
收藏 0
点赞 0
评论 0
/**
* 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();
}
ViewCamera.java 文件源码
项目:DUTS3-CPOA-ProjetTarot
阅读 24
收藏 0
点赞 0
评论 0
/**
* 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();
}
}
MeshPickingTests.java 文件源码
项目:openjfx-8u-dev-tests
阅读 33
收藏 0
点赞 0
评论 0
/**
* 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);
}
}
AnimationTransitionApp.java 文件源码
项目:openjfx-8u-dev-tests
阅读 30
收藏 0
点赞 0
评论 0
@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;
}
Utils.java 文件源码
项目:gluon-samples
阅读 31
收藏 0
点赞 0
评论 0
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;
}
DockEvent.java 文件源码
项目:DockFX
阅读 36
收藏 0
点赞 0
评论 0
/**
* 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;
}
Quaternion.java 文件源码
项目:fr.xs.jtk
阅读 37
收藏 0
点赞 0
评论 0
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));
}
}
OffRosettePoint.java 文件源码
项目:COrnLathe
阅读 25
收藏 0
点赞 0
评论 0
/**
* 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;
}
Surface.java 文件源码
项目:COrnLathe
阅读 30
收藏 0
点赞 0
评论 0
/**
* 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;
}
SpiralLine.java 文件源码
项目:COrnLathe
阅读 103
收藏 0
点赞 0
评论 0
/**
* 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;
}
SpiralCut.java 文件源码
项目:COrnLathe
阅读 26
收藏 0
点赞 0
评论 0
/**
* 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;
}
LinePoint.java 文件源码
项目:COrnLathe
阅读 31
收藏 0
点赞 0
评论 0
/**
* 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;
}
}
StarterFrame.java 文件源码
项目:javafx-3d-surface-chart
阅读 30
收藏 0
点赞 0
评论 0
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;
}
MeshImageBuilder.java 文件源码
项目:javafx-3d-surface-chart
阅读 26
收藏 0
点赞 0
评论 0
/**
* 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;
}
MeshImageBuilder.java 文件源码
项目:javafx-3d-surface-chart
阅读 26
收藏 0
点赞 0
评论 0
/**
* 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;
}
MeshImageBuilder.java 文件源码
项目:javafx-3d-surface-chart
阅读 26
收藏 0
点赞 0
评论 0
/**
* 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;
}
MeshCalculationComposite.java 文件源码
项目:javafx-3d-surface-chart
阅读 26
收藏 0
点赞 0
评论 0
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);
}
Drag3DObject.java 文件源码
项目:Gargoyle
阅读 32
收藏 0
点赞 0
评论 0
public Vec3d localToScene(Vec3d pt, Vec3d result) {
Point3D res = camera.localToParentTransformProperty().get().transform(pt.x, pt.y, pt.z);
if (camera.getParent() != null) {
res = camera.getParent().localToSceneTransformProperty().get().transform(res);
}
result.set(res.getX(), res.getY(), res.getZ());
return result;
}
ShapesPickingTests.java 文件源码
项目:openjfx-8u-dev-tests
阅读 30
收藏 0
点赞 0
评论 0
private void centerTestCase() {
Point3D expected = new Point3D(0, 0, -1.0);
Rectangle rect = getAppRectangle();
PickResult pr = click(new Point(rect.x + rect.width / 2 - 1, rect.y + rect.height / 2 - 1));
if (!isEqualsPoints(expected, pr.getIntersectedPoint())) {
Assert.fail("expected " + expected + "but was " + pr.getIntersectedPoint());
}
}
PickingTestOverall.java 文件源码
项目:openjfx-8u-dev-tests
阅读 27
收藏 0
点赞 0
评论 0
public static boolean isEqualsPoints(Point3D pt1, Point3D pt2) {
if (Math.abs(pt1.getX() - pt2.getX()) > eps
|| Math.abs(pt1.getY() - pt2.getY()) > eps
|| Math.abs(pt1.getZ() - pt2.getZ()) > eps) {
return false;
}
return true;
}
MeshPickingTests.java 文件源码
项目:openjfx-8u-dev-tests
阅读 23
收藏 0
点赞 0
评论 0
private void fillPathPointsArray(int startX, int startY, double dx, double dy, Point3D points[], int start, int iterations) {
for (int i = 0; i < iterations; i++) {
Point clickPoint = new Point(startX + (i * dx), startY + (i * dy));
PickResult pr = click(clickPoint);
points[start + i] = pr.getIntersectedPoint();
}
}
CameraIsolateTests.java 文件源码
项目:openjfx-8u-dev-tests
阅读 109
收藏 0
点赞 0
评论 0
protected void setRotationAxis(final Point3D pd) {
new GetAction() {
@Override
public void run(Object... os) throws Exception {
getCameraIsolateTestingFace().getCamera().setRotationAxis(pd);
}
}.dispatch(Root.ROOT.getEnvironment());
}
SubSceneBasicPropsTest.java 文件源码
项目:openjfx-8u-dev-tests
阅读 26
收藏 0
点赞 0
评论 0
private void setRotationAxis(final Point3D p3d){
new GetAction() {
@Override
public void run(Object... os) throws Exception {
application.setRotationAxis(p3d);
}
}.dispatch(Root.ROOT.getEnvironment());
}
Utils.java 文件源码
项目:gluon-samples
阅读 25
收藏 0
点赞 0
评论 0
private static Point3D getMeshNormal(MeshView mesh){
TriangleMesh tm = (TriangleMesh) mesh.getMesh();
float[] fPoints = new float[tm.getPoints().size()];
tm.getPoints().toArray(fPoints);
Point3D BA = new Point3D(fPoints[3] - fPoints[0], fPoints[4] - fPoints[1], fPoints[5] - fPoints[2]);
Point3D CA = new Point3D(fPoints[6] - fPoints[0], fPoints[7] - fPoints[1], fPoints[8] - fPoints[2]);
Point3D normal = BA.crossProduct(CA);
Affine a = new Affine(mesh.getTransforms().get(0));
return a.transform(normal.normalize());
}
LinuxCNCConnection.java 文件源码
项目:COrnLathe
阅读 26
收藏 0
点赞 0
评论 0
/**
* Get the relative actual position of LinuxCNC.
*
* @return XZC are in x,y,z respectively
*/
public Point3D getPosition() {
if (!connected) {
return Point3D.ZERO; // return 0,0,0 if no connection
}
String str = sendCommand("get rel_act_pos");
String[] strs = str.split(" ");
double x = Double.parseDouble(strs[1]);
double z = Double.parseDouble(strs[3]);
double c = Double.parseDouble(strs[6]);
return new Point3D(x, z, c);
}
FPSCameraController.java 文件源码
项目:eavp
阅读 33
收藏 0
点赞 0
评论 0
@Override
public void pitchCamera(double radians) {
// Get the x direction for the camera's current heading
Transform worldTransform = xform.getLocalToSceneTransform();
double xx = worldTransform.getMxx();
double xy = worldTransform.getMxy();
double xz = worldTransform.getMxz();
Point3D xDir = new Point3D(xx, xy, xz).normalize();
// Create a new rotation along that axis and apply it to the camera
Rotate rotation = new Rotate(radians * 180 / Math.PI, xDir);
affine.append(rotation);
}
FPSCameraController.java 文件源码
项目:eavp
阅读 30
收藏 0
点赞 0
评论 0
@Override
public void strafeCamera(double distance) {
Transform worldTransform = xform.getLocalToSceneTransform();
double xx = worldTransform.getMxx();
double xy = worldTransform.getMxy();
double xz = worldTransform.getMxz();
Point3D xDir = new Point3D(xx, xy, xz).normalize();
Point3D moveVec = xDir.multiply(distance);
affine.appendTranslation(moveVec.getX(), moveVec.getY(),
moveVec.getZ());
}