Class SegmentPoint2i
- java.lang.Object
-
- org.arakhne.afc.math.geometry.d2.i.AbstractShape2i<SegmentPoint2i>
-
- org.arakhne.afc.math.geometry.d2.i.SegmentPoint2i
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Segment2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
,Shape2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
,Shape2i<SegmentPoint2i>
,Shape2D<Shape2i<?>,SegmentPoint2i,PathIterator2ai<PathElement2i>,Point2i,Vector2i,Rectangle2i>
,JsonableObject
public class SegmentPoint2i extends AbstractShape2i<SegmentPoint2i> implements Segment2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
A 2D segment/line encapsulating points with 2 integer numbers.This segment is defined by its two extremities. It should not differ from the original Segment2i except from storage type.
- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Thomas PIOTROWSKI, Stéphane GALLAND
- 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.ai.Segment2ai
Segment2ai.AbstractSegmentPathIterator<IE extends PathElement2ai>, Segment2ai.BresenhamLineIterator<P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>>, Segment2ai.SegmentPathIterator<IE extends PathElement2ai>, Segment2ai.TransformedSegmentPathIterator<IE extends PathElement2ai>
-
-
Constructor Summary
Constructors Constructor Description SegmentPoint2i()
Construct an empty segment.SegmentPoint2i(int x1, int y1, int x2, int y2)
Construct a segment with the two given points.SegmentPoint2i(Segment2ai<?,?,?,?,?,?> segment)
Constructor by copy.SegmentPoint2i(Point2i p1, Point2i p2)
Construct a segment with the two given points.SegmentPoint2i(SegmentPoint2i segment)
Constructor by copy.SegmentPoint2i(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 Shape2i<?>
createTransformedShape(Transform2D transform)
Apply the transformation to the shape and reply the result.Point2i
getP1()
Replies the first point.Point2i
getP2()
Replies the second point.int
getX1()
Replies the X of the first point.int
getX2()
Replies the X of the second point.int
getY1()
Replies the Y of the first point.int
getY2()
Replies the Y of the second point.int
hashCode()
void
set(int x1, int y1, int x2, int y2)
Change the line.void
setP1(int x, int y)
Change the first point.void
setP1(Point2i p1)
Set the first point of the segment.void
setP2(int x, int y)
Change the second point.void
setP2(Point2i p2)
Set the second point of the segment.void
setX1(int x)
Change the X of the first point.void
setX2(int x)
Change the X of the second point.void
setY1(int y)
Change the Y of the first point.void
setY2(int y)
Change the Y of the second point.String
toString()
-
Methods inherited from class org.arakhne.afc.math.geometry.d2.i.AbstractShape2i
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.ai.Segment2ai
clear, clipToRectangle, contains, contains, contains, equalsToShape, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getDistanceL1, getDistanceLinf, getDistanceSquared, getDistanceSquared, getDistanceSquared, getFarthestPointTo, getPathIterator, getPointIterator, intersects, intersects, intersects, intersects, intersects, isEmpty, set, set, setP1, setP2, toBoundingBox, transform, translate
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.ai.Shape2ai
contains, getClosestPointTo, getClosestPointTo, 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
-
SegmentPoint2i
public SegmentPoint2i()
Construct an empty segment.
-
SegmentPoint2i
public SegmentPoint2i(Point2D<?,?> p1, Point2D<?,?> p2)
Construct a segment with the two given points.- Parameters:
p1
- first point.p2
- second point.
-
SegmentPoint2i
public SegmentPoint2i(Point2i p1, Point2i p2)
Construct a segment with the two given points.- Parameters:
p1
- first point.p2
- second point.
-
SegmentPoint2i
public SegmentPoint2i(Segment2ai<?,?,?,?,?,?> segment)
Constructor by copy.- Parameters:
segment
- the segment to copy.
-
SegmentPoint2i
public SegmentPoint2i(SegmentPoint2i segment)
Constructor by copy.- Parameters:
segment
- the segment to copy.
-
SegmentPoint2i
public SegmentPoint2i(int x1, int y1, int x2, int 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
-
hashCode
@Pure public int hashCode()
- Specified by:
hashCode
in classAbstractShape2i<SegmentPoint2i>
-
toString
@Pure public String toString()
- Overrides:
toString
in classAbstractShape2i<SegmentPoint2i>
-
createTransformedShape
@Pure public Shape2i<?> 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 interfaceShape2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Specified by:
createTransformedShape
in interfaceShape2D<Shape2i<?>,SegmentPoint2i,PathIterator2ai<PathElement2i>,Point2i,Vector2i,Rectangle2i>
- Parameters:
transform
- is the transformation to apply to the shape.- Returns:
- the result of the transformation.
-
set
public void set(int x1, int y1, int x2, int y2)
Description copied from interface:Segment2ai
Change the line.- Specified by:
set
in interfaceSegment2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- 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 int getX1()
Description copied from interface:Segment2ai
Replies the X of the first point.- Specified by:
getX1
in interfaceSegment2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Returns:
- the x of the first point.
-
setX1
public void setX1(int x)
Description copied from interface:Segment2ai
Change the X of the first point.- Specified by:
setX1
in interfaceSegment2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Parameters:
x
- the x of the first point.
-
getY1
@Pure public int getY1()
Description copied from interface:Segment2ai
Replies the Y of the first point.- Specified by:
getY1
in interfaceSegment2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Returns:
- the y of the first point.
-
setY1
public void setY1(int y)
Description copied from interface:Segment2ai
Change the Y of the first point.- Specified by:
setY1
in interfaceSegment2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Parameters:
y
- the y of the first point.
-
getX2
@Pure public int getX2()
Description copied from interface:Segment2ai
Replies the X of the second point.- Specified by:
getX2
in interfaceSegment2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Returns:
- the x of the second point.
-
setX2
public void setX2(int x)
Description copied from interface:Segment2ai
Change the X of the second point.- Specified by:
setX2
in interfaceSegment2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Parameters:
x
- the x of the second point.
-
getY2
@Pure public int getY2()
Description copied from interface:Segment2ai
Replies the Y of the second point.- Specified by:
getY2
in interfaceSegment2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Returns:
- the y of the second point.
-
setY2
public void setY2(int y)
Description copied from interface:Segment2ai
Change the Y of the second point.- Specified by:
setY2
in interfaceSegment2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Parameters:
y
- the y of the second point.
-
getP1
public Point2i getP1()
Description copied from interface:Segment2ai
Replies the first point.- Specified by:
getP1
in interfaceSegment2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Returns:
- the first point.
-
setP1
public void setP1(int x, int y)
Description copied from interface:Segment2ai
Change the first point.- Specified by:
setP1
in interfaceSegment2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Parameters:
x
- x coordinate of the first point.y
- y coordinate of the first point.
-
setP1
public void setP1(Point2i p1)
Set the first point of the segment.- Parameters:
p1
- the p1 to set
-
getP2
public Point2i getP2()
Description copied from interface:Segment2ai
Replies the second point.- Specified by:
getP2
in interfaceSegment2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Returns:
- the second point.
-
setP2
public void setP2(int x, int y)
Description copied from interface:Segment2ai
Change the second point.- Specified by:
setP2
in interfaceSegment2ai<Shape2i<?>,SegmentPoint2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
- Parameters:
x
- x coordinate the second point.y
- y coordinate the second point.
-
setP2
public void setP2(Point2i p2)
Set the second point of the segment.- Parameters:
p2
- the p2 to set
-
-