Java Code Examples for javafx.geometry.Point2D#multiply()
The following examples show how to use
javafx.geometry.Point2D#multiply() .
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: UtilitiesPoint2D.java From JavaFXSmartGraph with MIT License | 3 votes |
/** * Computes the vector of the repelling force between two node. * * @param from Coordinates of the first node * @param to Coordinates of the second node * @param scale Scale factor to be used * @return Computed force vector */ public static Point2D repellingForce(Point2D from, Point2D to, double scale) { double distance = from.distance(to); Point2D vec = to.subtract(from).normalize(); double factor = -repellingFunction(distance, scale); return vec.multiply(factor); }
Example 2
Source File: UtilitiesPoint2D.java From JavaFXSmartGraph with MIT License | 1 votes |
/** * Computes the vector of the attractive force between two nodes. * * @param from Coordinates of the first node * @param to Coordinates of the second node * @param globalCount Global number of nodes * @param force Force factor to be used * @param scale Scale factor to be used * * @return Computed force vector */ public static Point2D attractiveForce(Point2D from, Point2D to, int globalCount, double force, double scale) { double distance = from.distance(to); Point2D vec = to.subtract(from).normalize(); double factor = attractiveFunction(distance, globalCount, force, scale); return vec.multiply(factor); }