Class Segment2dfx
- java.lang.Object
-
- org.arakhne.afc.math.geometry.d2.dfx.AbstractShape2dfx<Segment2dfx>
-
- org.arakhne.afc.math.geometry.d2.dfx.Segment2dfx
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Segment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
,Shape2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
,Shape2dfx<Segment2dfx>
,Shape2D<Shape2dfx<?>,Segment2dfx,PathIterator2afp<PathElement2dfx>,Point2dfx,Vector2dfx,Rectangle2dfx>
,JsonableObject
public class Segment2dfx extends AbstractShape2dfx<Segment2dfx> implements Segment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
A 2D segment/line encapsulating points with 2 double precision FX properties.This segment is defined by its two extremities. It should not differ from the original Segment2dfx except from storage type.
- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:49
- Author:
- Thomas PIOTROWSKI, Stéphane GALLAND, Hamza JAFFALI
- See Also:
- Serialized Form
- Maven Group Id:
- org.arakhne.afc.advanced
- Maven Artifact Id:
- mathfx
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.arakhne.afc.math.geometry.d2.afp.Segment2afp
Segment2afp.SegmentPathIterator<T extends PathElement2afp>, Segment2afp.UncertainIntersection
-
-
Field Summary
-
Fields inherited from class org.arakhne.afc.math.geometry.d2.dfx.AbstractShape2dfx
boundingBox
-
-
Constructor Summary
Constructors Constructor Description Segment2dfx()
Construct an empty segment.Segment2dfx(double x1, double y1, double x2, double y2)
Construct a segment with the two given points.Segment2dfx(Segment2afp<?,?,?,?,?,?> segment)
Constructor by copy.Segment2dfx(Point2dfx p1, Point2dfx p2)
Constructor by setting the two given points.Segment2dfx(Segment2dfx segment)
Constructor by setting.Segment2dfx(Point2D<?,?> p1, Point2D<?,?> p2)
Construct a segment with the two given points.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javafx.beans.property.ObjectProperty<Rectangle2dfx>
boundingBoxProperty()
Replies the property that contains the bounding box for this shape.Segment2dfx
clone()
Clone this shape.Segment2dfx
createTransformedShape(Transform2D transform)
Apply the transformation to the shape and reply the result.Point2dfx
getP1()
Replies the first point.Point2dfx
getP2()
Replies the second point.double
getX1()
Replies the X of the first point.double
getX2()
Replies the X of the second point.double
getY1()
Replies the Y of the first point.double
getY2()
Replies the Y of the second point.int
hashCode()
void
set(double x1, double y1, double x2, double y2)
Change the line.void
setP1(double x, double y)
Change the first point.void
setP1(Point2dfx pt)
Set the oriented point as the first point of this Segment2dfx to preserve length.void
setP1(Point2D<?,?> pt)
Change the first point.void
setP2(double x, double y)
Change the second point.void
setP2(Point2dfx pt)
Set the oriented point as the second point of this Segment2dfx to preserve length.void
setP2(Point2D<?,?> pt)
Change the second point.void
setX1(double x)
Sets a new value in the X of the first point.void
setX2(double x)
Sets a new value in the X of the second point.void
setY1(double y)
Sets a new value in the Y of the first point.void
setY2(double y)
Sets a new value in the Y of the second point.String
toString()
javafx.beans.property.DoubleProperty
x1Property()
Replies the property that is the x coordinate of the first segment point.javafx.beans.property.DoubleProperty
x2Property()
Replies the property that is the x coordinate of the second segment point.javafx.beans.property.DoubleProperty
y1Property()
Replies the property that is the y coordinate of the first segment point.javafx.beans.property.DoubleProperty
y2Property()
Replies the property that is the x coordinate of the second segment point.-
Methods inherited from class org.arakhne.afc.math.geometry.d2.dfx.AbstractShape2dfx
equals, getGeomFactory, toJson
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.afp.Segment2afp
clear, clipToRectangle, contains, contains, contains, equalsToShape, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getDistanceL1, getDistanceLinf, getDistanceSquared, getDistanceSquared, getFarthestPointTo, getLength, getLengthSquared, getPathIterator, intersects, intersects, intersects, intersects, intersects, intersects, intersects, intersects, intersects, intersects, isEmpty, set, set, toBoundingBox, transform, translate
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.afp.Shape2afp
contains, getClosestPointTo, getClosestPointTo, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getGeomFactory, intersects, intersects, toBoundingBox, translate
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.Shape2D
equalsToPathIterator, getDistance, getDistance, getPathIterator, operator_add, operator_and, operator_and, operator_minus, operator_multiply, operator_plus, operator_remove, operator_upTo
-
-
-
-
Constructor Detail
-
Segment2dfx
public Segment2dfx()
Construct an empty segment.
-
Segment2dfx
public Segment2dfx(Point2dfx p1, Point2dfx p2)
Constructor by setting the two given points.- Parameters:
p1
- the point to set as first point.p2
- the point to set as second point.
-
Segment2dfx
public Segment2dfx(Point2D<?,?> p1, Point2D<?,?> p2)
Construct a segment with the two given points.- Parameters:
p1
- first point.p2
- second point.
-
Segment2dfx
public Segment2dfx(Segment2dfx segment)
Constructor by setting.- Parameters:
segment
- the segment to set.
-
Segment2dfx
public Segment2dfx(Segment2afp<?,?,?,?,?,?> segment)
Constructor by copy.- Parameters:
segment
- the segment to copy.
-
Segment2dfx
public Segment2dfx(double x1, double y1, double x2, double y2)
Construct a segment with the two given points.- Parameters:
x1
- x coordinate of the first point.y1
- y coordinate of the first point.x2
- x coordinate of the second point.y2
- y coordinate of the second point.
-
-
Method Detail
-
clone
public Segment2dfx clone()
Description copied from interface:Shape2D
Clone this shape.- Specified by:
clone
in interfaceShape2D<Shape2dfx<?>,Segment2dfx,PathIterator2afp<PathElement2dfx>,Point2dfx,Vector2dfx,Rectangle2dfx>
- Overrides:
clone
in classAbstractShape2dfx<Segment2dfx>
- Returns:
- the clone.
-
hashCode
@Pure public int hashCode()
- Specified by:
hashCode
in classAbstractShape2dfx<Segment2dfx>
-
toString
@Pure public String toString()
- Overrides:
toString
in classAbstractShape2dfx<Segment2dfx>
-
createTransformedShape
@Pure public Segment2dfx createTransformedShape(Transform2D transform)
Description copied from interface:Shape2D
Apply the transformation to the shape and reply the result. This function does not change the current shape.- Specified by:
createTransformedShape
in interfaceShape2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Specified by:
createTransformedShape
in interfaceShape2D<Shape2dfx<?>,Segment2dfx,PathIterator2afp<PathElement2dfx>,Point2dfx,Vector2dfx,Rectangle2dfx>
- Parameters:
transform
- is the transformation to apply to the shape.- Returns:
- the result of the transformation.
-
set
public void set(double x1, double y1, double x2, double y2)
Description copied from interface:Segment2afp
Change the line.- Specified by:
set
in interfaceSegment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Parameters:
x1
- x coordinate of the first point.y1
- y coordinate of the first point.x2
- x coordinate of the second point.y2
- y coordinate of the second point.
-
setX1
public void setX1(double x)
Description copied from interface:Segment2afp
Sets a new value in the X of the first point.- Specified by:
setX1
in interfaceSegment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Parameters:
x
- the new value double x
-
setY1
public void setY1(double y)
Description copied from interface:Segment2afp
Sets a new value in the Y of the first point.- Specified by:
setY1
in interfaceSegment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Parameters:
y
- the new value double y
-
setX2
public void setX2(double x)
Description copied from interface:Segment2afp
Sets a new value in the X of the second point.- Specified by:
setX2
in interfaceSegment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Parameters:
x
- the new value double x
-
setY2
public void setY2(double y)
Description copied from interface:Segment2afp
Sets a new value in the Y of the second point.- Specified by:
setY2
in interfaceSegment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Parameters:
y
- the new value double y
-
getX1
@Pure public double getX1()
Description copied from interface:Segment2afp
Replies the X of the first point.- Specified by:
getX1
in interfaceSegment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Returns:
- the x of the first point.
-
x1Property
@Pure public javafx.beans.property.DoubleProperty x1Property()
Replies the property that is the x coordinate of the first segment point.- Returns:
- the x1 property.
-
getY1
@Pure public double getY1()
Description copied from interface:Segment2afp
Replies the Y of the first point.- Specified by:
getY1
in interfaceSegment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Returns:
- the y of the first point.
-
y1Property
@Pure public javafx.beans.property.DoubleProperty y1Property()
Replies the property that is the y coordinate of the first segment point.- Returns:
- the y1 property.
-
getX2
@Pure public double getX2()
Description copied from interface:Segment2afp
Replies the X of the second point.- Specified by:
getX2
in interfaceSegment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Returns:
- the x of the second point.
-
x2Property
@Pure public javafx.beans.property.DoubleProperty x2Property()
Replies the property that is the x coordinate of the second segment point.- Returns:
- the x2 property.
-
getY2
@Pure public double getY2()
Description copied from interface:Segment2afp
Replies the Y of the second point.- Specified by:
getY2
in interfaceSegment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Returns:
- the y of the second point.
-
y2Property
@Pure public javafx.beans.property.DoubleProperty y2Property()
Replies the property that is the x coordinate of the second segment point.- Returns:
- the x2 property.
-
getP1
public Point2dfx getP1()
Description copied from interface:Segment2afp
Replies the first point.- Specified by:
getP1
in interfaceSegment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Returns:
- the first point.
-
setP1
public void setP1(double x, double y)
Description copied from interface:Segment2afp
Change the first point.- Specified by:
setP1
in interfaceSegment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Parameters:
x
- x coordinate of the first point.y
- y coordinate of the first point.
-
setP1
public void setP1(Point2D<?,?> pt)
Description copied from interface:Segment2afp
Change the first point.- Specified by:
setP1
in interfaceSegment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Parameters:
pt
- the first point.
-
setP1
public void setP1(Point2dfx pt)
Set the oriented point as the first point of this Segment2dfx to preserve length.- Parameters:
pt
- the point.
-
getP2
public Point2dfx getP2()
Description copied from interface:Segment2afp
Replies the second point.- Specified by:
getP2
in interfaceSegment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Returns:
- the second point.
-
setP2
public void setP2(double x, double y)
Description copied from interface:Segment2afp
Change the second point.- Specified by:
setP2
in interfaceSegment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Parameters:
x
- x coordinate of the second point.y
- y coordinate of the second point.
-
setP2
public void setP2(Point2D<?,?> pt)
Description copied from interface:Segment2afp
Change the second point.- Specified by:
setP2
in interfaceSegment2afp<Shape2dfx<?>,Segment2dfx,PathElement2dfx,Point2dfx,Vector2dfx,Rectangle2dfx>
- Parameters:
pt
- the second point.
-
setP2
public void setP2(Point2dfx pt)
Set the oriented point as the second point of this Segment2dfx to preserve length.- Parameters:
pt
- the point.
-
boundingBoxProperty
public javafx.beans.property.ObjectProperty<Rectangle2dfx> boundingBoxProperty()
Description copied from interface:Shape2dfx
Replies the property that contains the bounding box for this shape.- Specified by:
boundingBoxProperty
in interfaceShape2dfx<Segment2dfx>
- Returns:
- the bounding box.
-
-