javafx.scene.transform.NonInvertibleTransformException Java Examples
The following examples show how to use
javafx.scene.transform.NonInvertibleTransformException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Canvas.java From latexdraw with GNU General Public License v3.0 | 6 votes |
public List<Shape> getIntersectedShapes(final Bounds selectionBorder) { final Rectangle selectionRec = new Rectangle(selectionBorder.getMinX() + Canvas.ORIGIN.getX(), selectionBorder.getMinY() + Canvas.ORIGIN.getY(), selectionBorder.getWidth(), selectionBorder.getHeight()); // Transforming the selection rectangle to match the transformation of the canvas. selectionRec.getTransforms().setAll(getLocalToSceneTransform()); return getViews().getChildren().stream().filter(view -> { Bounds bounds; final Transform transform = view.getLocalToParentTransform(); if(transform.isIdentity()) { bounds = selectionBorder; }else { try { bounds = transform.createInverse().transform(selectionBorder); }catch(final NonInvertibleTransformException ex) { bounds = selectionBorder; } } return view.intersects(bounds) && ((ViewShape<?>) view).getActivatedShapes().stream().anyMatch(sh -> !javafx.scene.shape.Shape.intersect(sh, selectionRec).getLayoutBounds().isEmpty()); }) .map(view -> (Shape) view.getUserData()) .collect(Collectors.toList()); }
Example #2
Source File: IBendableContentPart.java From gef with Eclipse Public License 2.0 | 5 votes |
/** * Transforms the given {@link List} of * {@link IBendableContentPart.BendPoint}s according to the change * specified by the given current and final {@link Affine} * transformations. * * @param bendPoints * The {@link List} of * {@link IBendableContentPart.BendPoint}s to transform. * @param currentTransform * The current {@link Affine} transformation. * @param totalTransform * The final {@link Affine} transformation. * @return The given, transformed {@link List} of * {@link IBendableContentPart.BendPoint}s. */ static List<BendPoint> transform(List<BendPoint> bendPoints, Affine currentTransform, Affine totalTransform) { // compute delta transform Affine inverse; try { inverse = currentTransform.createInverse(); } catch (NonInvertibleTransformException e) { throw new RuntimeException(e); } Transform deltaTransform = new Affine( inverse.createConcatenation(totalTransform)); // optimize for identity transform if (deltaTransform.isIdentity()) { return bendPoints; } // System.out.println("Transform by " + deltaTransform.getTx() + ", // " // + deltaTransform.getTy() + "."); AffineTransform tx = FX2Geometry.toAffineTransform(deltaTransform); // transform unattached bend points in-place for (BendPoint bp : bendPoints) { if (!bp.isAttached()) { bp.getPosition().transform(tx); } } return bendPoints; }
Example #3
Source File: CuboidMesh.java From FXyzLib with GNU General Public License v3.0 | 5 votes |
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; }
Example #4
Source File: PrismMesh.java From FXyzLib with GNU General Public License v3.0 | 5 votes |
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; }
Example #5
Source File: SegmentedSphereMesh.java From FXyzLib with GNU General Public License v3.0 | 5 votes |
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; }
Example #6
Source File: FrustumMesh.java From FXyzLib with GNU General Public License v3.0 | 5 votes |
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; }
Example #7
Source File: TetrahedraMesh.java From FXyzLib with GNU General Public License v3.0 | 5 votes |
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; }
Example #8
Source File: BillBoardBehaviorTest.java From FXyzLib with GNU General Public License v3.0 | 5 votes |
@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(); }