Class SegmentPoint2d
- java.lang.Object
-
- org.arakhne.afc.math.geometry.d2.d.AbstractShape2d<SegmentPoint2d>
-
- org.arakhne.afc.math.geometry.d2.d.SegmentPoint2d
-
- All Implemented Interfaces:
Serializable,Cloneable,Segment2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>,Shape2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>,Shape2d<SegmentPoint2d>,Shape2D<Shape2d<?>,SegmentPoint2d,PathIterator2afp<PathElement2d>,Point2d,Vector2d,Rectangle2d>,JsonableObject
public class SegmentPoint2d extends AbstractShape2d<SegmentPoint2d> implements Segment2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
A 2D segment/line encapsulating points with 2 double precision numbers.This segment is defined by its two extremities. It should not differ from the original Segment2d except from storage type.
- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Thomas PIOTROWSKI, Stéphane GALLAND, Hamza JAFFALI
- See Also:
- Serialized Form
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.arakhne.afc.math.geometry.d2.afp.Segment2afp
Segment2afp.SegmentPathIterator<T extends PathElement2afp>, Segment2afp.UncertainIntersection
-
-
Constructor Summary
Constructors Constructor Description SegmentPoint2d()Construct an empty segment.SegmentPoint2d(double x1, double y1, double x2, double y2)Construct a segment from the two given points.SegmentPoint2d(Segment2afp<?,?,?,?,?,?> segment)Constructor by copy.SegmentPoint2d(Point2d p1, Point2d p2)Construct a segment from the two given points.SegmentPoint2d(SegmentPoint2d segment)Constructor by copy.SegmentPoint2d(Point2D<?,?> p1, Point2D<?,?> p2)Construct a segment from the two given points.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SegmentPoint2dcreateTransformedShape(Transform2D transform)Apply the transformation to the shape and reply the result.Point2dgetP1()Replies the first point.Point2dgetP2()Replies the second point.doublegetX1()Replies the X of the first point.doublegetX2()Replies the X of the second point.doublegetY1()Replies the Y of the first point.doublegetY2()Replies the Y of the second point.inthashCode()voidset(double x1, double y1, double x2, double y2)Change the line.voidsetP1(double x, double y)Change the first point.voidsetP1(Point2d p1)Set the first point of the segment.voidsetP2(double x, double y)Change the second point.voidsetP2(Point2d p2)Set the second point of the segment.voidsetX1(double x)Sets a new value in the X of the first point.voidsetX2(double x)Sets a new value in the X of the second point.voidsetY1(double y)Sets a new value in the Y of the first point.voidsetY2(double y)Sets a new value in the Y of the second point.StringtoString()-
Methods inherited from class org.arakhne.afc.math.geometry.d2.d.AbstractShape2d
addShapeGeometryChangeListener, clone, equals, fireGeometryChange, getGeomFactory, removeShapeGeometryChangeListener, 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, setP1, setP2, 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
clone, equalsToPathIterator, getDistance, getDistance, getPathIterator, operator_add, operator_and, operator_and, operator_minus, operator_multiply, operator_plus, operator_remove, operator_upTo
-
-
-
-
Constructor Detail
-
SegmentPoint2d
public SegmentPoint2d()
Construct an empty segment.
-
SegmentPoint2d
public SegmentPoint2d(Point2D<?,?> p1, Point2D<?,?> p2)
Construct a segment from the two given points.- Parameters:
p1- first point.p2- second point.
-
SegmentPoint2d
public SegmentPoint2d(Point2d p1, Point2d p2)
Construct a segment from the two given points.- Parameters:
p1- first point.p2- second point.
-
SegmentPoint2d
public SegmentPoint2d(Segment2afp<?,?,?,?,?,?> segment)
Constructor by copy.- Parameters:
segment- the segment to copy.
-
SegmentPoint2d
public SegmentPoint2d(SegmentPoint2d segment)
Constructor by copy.- Parameters:
segment- the segment to copy.
-
SegmentPoint2d
public SegmentPoint2d(double x1, double y1, double x2, double y2)Construct a segment from 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
-
hashCode
@Pure public int hashCode()
- Specified by:
hashCodein classAbstractShape2d<SegmentPoint2d>
-
toString
@Pure public String toString()
- Overrides:
toStringin classAbstractShape2d<SegmentPoint2d>
-
createTransformedShape
@Pure public SegmentPoint2d createTransformedShape(Transform2D transform)
Description copied from interface:Shape2DApply the transformation to the shape and reply the result. This function does not change the current shape.- Specified by:
createTransformedShapein interfaceShape2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Specified by:
createTransformedShapein interfaceShape2D<Shape2d<?>,SegmentPoint2d,PathIterator2afp<PathElement2d>,Point2d,Vector2d,Rectangle2d>- 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:Segment2afpChange the line.- Specified by:
setin interfaceSegment2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- 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.
-
getX1
@Pure public double getX1()
Description copied from interface:Segment2afpReplies the X of the first point.- Specified by:
getX1in interfaceSegment2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Returns:
- the x of the first point.
-
setX1
public void setX1(double x)
Description copied from interface:Segment2afpSets a new value in the X of the first point.- Specified by:
setX1in interfaceSegment2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Parameters:
x- the new value double x
-
getY1
@Pure public double getY1()
Description copied from interface:Segment2afpReplies the Y of the first point.- Specified by:
getY1in interfaceSegment2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Returns:
- the y of the first point.
-
setY1
public void setY1(double y)
Description copied from interface:Segment2afpSets a new value in the Y of the first point.- Specified by:
setY1in interfaceSegment2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Parameters:
y- the new value double y
-
getX2
@Pure public double getX2()
Description copied from interface:Segment2afpReplies the X of the second point.- Specified by:
getX2in interfaceSegment2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Returns:
- the x of the second point.
-
setX2
public void setX2(double x)
Description copied from interface:Segment2afpSets a new value in the X of the second point.- Specified by:
setX2in interfaceSegment2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Parameters:
x- the new value double x
-
getY2
@Pure public double getY2()
Description copied from interface:Segment2afpReplies the Y of the second point.- Specified by:
getY2in interfaceSegment2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Returns:
- the y of the second point.
-
setY2
public void setY2(double y)
Description copied from interface:Segment2afpSets a new value in the Y of the second point.- Specified by:
setY2in interfaceSegment2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Parameters:
y- the new value double y
-
getP1
public Point2d getP1()
Description copied from interface:Segment2afpReplies the first point.- Specified by:
getP1in interfaceSegment2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Returns:
- the first point.
-
setP1
public void setP1(double x, double y)Description copied from interface:Segment2afpChange the first point.- Specified by:
setP1in interfaceSegment2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Parameters:
x- x coordinate of the first point.y- y coordinate of the first point.
-
setP1
public void setP1(Point2d p1)
Set the first point of the segment.- Parameters:
p1- the point to set.
-
getP2
public Point2d getP2()
Description copied from interface:Segment2afpReplies the second point.- Specified by:
getP2in interfaceSegment2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Returns:
- the second point.
-
setP2
public void setP2(double x, double y)Description copied from interface:Segment2afpChange the second point.- Specified by:
setP2in interfaceSegment2afp<Shape2d<?>,SegmentPoint2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Parameters:
x- x coordinate of the second point.y- y coordinate of the second point.
-
setP2
public void setP2(Point2d p2)
Set the second point of the segment.- Parameters:
p2- the point to set.
-
-