本文整理汇总了Java中javafx.scene.transform.NonInvertibleTransformException类的典型用法代码示例。如果您正苦于以下问题:Java NonInvertibleTransformException类的具体用法?Java NonInvertibleTransformException怎么用?Java NonInvertibleTransformException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NonInvertibleTransformException类属于javafx.scene.transform包,在下文中一共展示了NonInvertibleTransformException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromIsoCoord
import javafx.scene.transform.NonInvertibleTransformException; //导入依赖的package包/类
/**
* Convert an iso coordinate to the (uncorrected) map tile that lives there.
* */
public MapPoint fromIsoCoord(final Point2D in, final CameraAngle a) {
Point2D t;
try {
switch (a) {
case UL:
t = rUL.inverseTransform(isoTransform.inverseTransform(in));
return new MapPoint((int) (t.getX() - 0.5), (int) t.getY());
case LL:
t = rLL.inverseTransform(isoTransform.inverseTransform(in));
return new MapPoint((int) (t.getX() + 0.5), (int) (t.getY() + 1.5));
case LR:
t = rLR.inverseTransform(isoTransform.inverseTransform(in));
return new MapPoint((int) (t.getX() + 1.5), (int) t.getY());
case UR:
t = rUR.inverseTransform(isoTransform.inverseTransform(in));
return new MapPoint((int) (t.getX() - 1.5), (int) (t.getY() + 0.5));
default: throw new RuntimeException(
"Invalid camera angle. This cannot happen");
}
} catch (NonInvertibleTransformException e) {
throw new RuntimeException("This cannot happen", e);
}
}
示例2: setViewportTransform
import javafx.scene.transform.NonInvertibleTransformException; //导入依赖的package包/类
public void setViewportTransform(Location projectionCenter, Location mapCenter, Point2D viewportCenter, double zoomLevel, double heading) {
viewportScale = getViewportScale(zoomLevel);
Point2D center = locationToPoint(mapCenter);
Affine transform = new Affine();
transform.prependTranslation(-center.getX(), -center.getY());
transform.prependScale(viewportScale, -viewportScale);
transform.prependRotation(heading);
transform.prependTranslation(viewportCenter.getX(), viewportCenter.getY());
viewportTransform.setToTransform(transform);
try {
transform.invert();
} catch (NonInvertibleTransformException ex) {
throw new RuntimeException(ex); // this will never happen
}
inverseViewportTransform.setToTransform(transform);
}
示例3: targetPointAtViewportCentre
import javafx.scene.transform.NonInvertibleTransformException; //导入依赖的package包/类
/**
* The point on the target at which the current centre point of the viewport is.
*
* @return a point on the target using target's coordinate system
*/
public Point2D targetPointAtViewportCentre() {
try {
return affine.inverseTransform(viewportCentre());
} catch (NonInvertibleTransformException e) {
// TODO what can be done?
throw new RuntimeException(e);
}
}
示例4: targetPointAt
import javafx.scene.transform.NonInvertibleTransformException; //导入依赖的package包/类
/**
* Computes the point on the target at the given viewport point.
*
* @param viewportPoint a point on the viewport
* @return a point on the target that corresponds to the viewport point or empty if the point
* is not within the the bound returned by {@link #getViewportBound()}
*/
public Optional<Point2D> targetPointAt(Point2D viewportPoint) {
if (!getViewportBound().contains(viewportPoint)) return Optional.empty();
try {
return Optional.of(affine.inverseTransform(viewportPoint));
} catch (NonInvertibleTransformException e) {
// TODO does this ever happen with just translate and scale?
return Optional.empty();
}
}
示例5: tileAtMouse
import javafx.scene.transform.NonInvertibleTransformException; //导入依赖的package包/类
/**
* Get the tile at the mouse position.
* @return null if there is no tile under the mouse.
* */
public MapPoint tileAtMouse(final Point2D mouse, final Stage stage) {
try {
return stage.collisions.mouseTileCollision(
totalScreenTransform.inverseTransform(mouse), angle);
} catch (NonInvertibleTransformException e) {
throw new RuntimeException("This cannot happen", e);
}
}
示例6: spriteAtMouse
import javafx.scene.transform.NonInvertibleTransformException; //导入依赖的package包/类
/**
* Get the sprite at the mouse position.
* @return null if there is no sprite under the mouse.
* */
public MapPoint spriteAtMouse(final Point2D mouse, final Stage stage) {
try {
return stage.collisions.mouseSpriteCollision(
totalScreenTransform.inverseTransform(mouse), angle);
} catch (NonInvertibleTransformException e) {
throw new RuntimeException("This cannot happen", e);
}
}
示例7: cameraToWorld
import javafx.scene.transform.NonInvertibleTransformException; //导入依赖的package包/类
/**
* Transforms a given bounding box from camera coordinates to world coordinates.
* @param b the given bounding box
* @return the transformed bounding box
*/
public Bounds cameraToWorld(Bounds b) {
Bounds world = null;
try {
world = worldToCamera().inverseTransform(b);
} catch (NonInvertibleTransformException e) {
e.printStackTrace();
}
return world;
}
示例8: computeZoom
import javafx.scene.transform.NonInvertibleTransformException; //导入依赖的package包/类
/**
* Compute the transformation to be applied for the zoom.
* @param zoom the scale of the zoom.
* @param center the center of the zoom, in camera space
* @return the transformation for the zoom.
*/
protected Transform computeZoom(double zoom, Point2D center) {
Point2D world;
Transform newScale = scale;
try {
world = scale.inverseTransform(center.getX() - toCenter.getX() - translate.getX(),
center.getY() - toCenter.getY() - translate.getY());
newScale = scale.createConcatenation(new Scale(zoom, zoom,
world.getX(), world.getY()));
} catch (NonInvertibleTransformException e) {
e.printStackTrace();
}
return newScale;
}
示例9: unTransform
import javafx.scene.transform.NonInvertibleTransformException; //导入依赖的package包/类
public Point3D unTransform(Point3D p){
try {
javafx.geometry.Point3D ta = a.inverseTransform(p.x,p.y,p.z);
return new Point3D((float)ta.getX(), (float)ta.getY(), (float)ta.getZ());
} catch (NonInvertibleTransformException ex) {
System.out.println("p not invertible "+p);
}
return p;
}
示例10: start
import javafx.scene.transform.NonInvertibleTransformException; //导入依赖的package包/类
@Override
public void start(Stage stage) throws NonInvertibleTransformException {
createSubscene();
createCameraView();
createOverlay();
Scene scene = new Scene(rootPane, 1024, 668);
stage.setTitle("Billbording Test!");
stage.setScene(scene);
stage.setMaximized(true);
stage.show();
}
示例11: setPosition
import javafx.scene.transform.NonInvertibleTransformException; //导入依赖的package包/类
/**
* Sets the global position.
*
* @param position
* the 2D position
*/
public void setPosition(Position position) {
try {
Point2D p = getParentFxNode().getLocalToSceneTransform().inverseTransform(position.getX(), position.getY());
setTranslateMatrix(Transform.translate(p.getX(), p.getY()));
} catch (NonInvertibleTransformException e) {
throw new TrydentInternalException("Local -> Scene not invertable! " + e);
}
}