Class BezierPathConverter
- java.lang.Object
-
- ch.sahits.game.openpatrician.display.service.BezierPathConverter
-
- All Implemented Interfaces:
ch.sahits.game.openpatrician.clientserverinterface.service.IPathConverter
public class BezierPathConverter extends java.lang.Object implements ch.sahits.game.openpatrician.clientserverinterface.service.IPathConverterCreate a Bezier path based on a set of points. The implementation is based on work described in http://devmag.org.za/2011/06/23/bzier-path-algorithms/- Author:
- Andi Hotz, (c) Sahits GmbH, 2016 Created on Jan 05, 2016
-
-
Constructor Summary
Constructors Constructor Description BezierPathConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcalculateDuration(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel, ch.sahits.game.openpatrician.clientserverinterface.service.PathInterpolator interpolator, double fraction)java.util.Optional<javafx.scene.shape.Path>createPath(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel, java.util.List<javafx.geometry.Point2D> pointedPath, double scale)java.util.List<javafx.geometry.Point2D>reduceLinePoints(java.util.List<javafx.geometry.Point2D> initialPoints)Reduce the number of points that are needed to describe the path.
-
-
-
Method Detail
-
createPath
public java.util.Optional<javafx.scene.shape.Path> createPath(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel, java.util.List<javafx.geometry.Point2D> pointedPath, double scale)- Specified by:
createPathin interfacech.sahits.game.openpatrician.clientserverinterface.service.IPathConverter
-
calculateDuration
public long calculateDuration(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel, ch.sahits.game.openpatrician.clientserverinterface.service.PathInterpolator interpolator, double fraction)- Specified by:
calculateDurationin interfacech.sahits.game.openpatrician.clientserverinterface.service.IPathConverter
-
reduceLinePoints
public java.util.List<javafx.geometry.Point2D> reduceLinePoints(java.util.List<javafx.geometry.Point2D> initialPoints)
Reduce the number of points that are needed to describe the path. Points that do not change the direction of the path can be eliminated if:- The distance to the last point left is larger than the distance to the shore
- Specified by:
reduceLinePointsin interfacech.sahits.game.openpatrician.clientserverinterface.service.IPathConverter- Parameters:
initialPoints- initial point of the line- Returns:
- list of points making up the path
-
-