- java.lang.Object
-
- org.arakhne.afc.math.geometry.d2.i.AbstractShape2i<Segment2i>
-
- org.arakhne.afc.math.geometry.d2.i.Segment2i
-
- All Implemented Interfaces:
Serializable,Cloneable,Segment2ai<Shape2i<?>,Segment2i,PathElement2i,Point2i,Vector2i,Rectangle2i>,Shape2ai<Shape2i<?>,Segment2i,PathElement2i,Point2i,Vector2i,Rectangle2i>,Shape2i<Segment2i>,Shape2D<Shape2i<?>,Segment2i,PathIterator2ai<PathElement2i>,Point2i,Vector2i,Rectangle2i>,JsonableObject
public class Segment2i extends AbstractShape2i<Segment2i> implements Segment2ai<Shape2i<?>,Segment2i,PathElement2i,Point2i,Vector2i,Rectangle2i>
A 2D segment/line with 2 integer numbers.- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- 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 Segment2i()Construct an empty segment.Segment2i(int x1, int y1, int x2, int y2)Construct a segment with the two given points.Segment2i(Segment2ai<?,?,?,?,?,?> segment)Constructor by copy.Segment2i(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.Point2igetP1()Replies the first point.Point2igetP2()Replies the second point.intgetX1()Replies the X of the first point.intgetX2()Replies the X of the second point.intgetY1()Replies the Y of the first point.intgetY2()Replies the Y of the second point.inthashCode()voidset(int x1, int y1, int x2, int y2)Change the line.voidsetX1(int x)Change the X of the first point.voidsetX2(int x)Change the X of the second point.voidsetY1(int y)Change the Y of the first point.voidsetY2(int y)Change the Y of the second point.-
Methods inherited from class org.arakhne.afc.math.geometry.d2.i.AbstractShape2i
addShapeGeometryChangeListener, clone, equals, fireGeometryChange, getGeomFactory, removeShapeGeometryChangeListener, toJson, toString
-
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, setP1, setP2, 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
-
Segment2i
public Segment2i()
Construct an empty segment.
-
Segment2i
public Segment2i(Point2D<?,?> p1, Point2D<?,?> p2)
Construct a segment with the two given points.- Parameters:
p1- first point.p2- second point.
-
Segment2i
public Segment2i(Segment2ai<?,?,?,?,?,?> segment)
Constructor by copy.- Parameters:
segment- the segment to copy.
-
Segment2i
public Segment2i(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:
hashCodein classAbstractShape2i<Segment2i>
-
createTransformedShape
@Pure public Shape2i<?> 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 interfaceShape2ai<Shape2i<?>,Segment2i,PathElement2i,Point2i,Vector2i,Rectangle2i>- Specified by:
createTransformedShapein interfaceShape2D<Shape2i<?>,Segment2i,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:Segment2aiChange the line.- Specified by:
setin interfaceSegment2ai<Shape2i<?>,Segment2i,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.
-
setX1
public void setX1(int x)
Description copied from interface:Segment2aiChange the X of the first point.- Specified by:
setX1in interfaceSegment2ai<Shape2i<?>,Segment2i,PathElement2i,Point2i,Vector2i,Rectangle2i>- Parameters:
x- the x of the first point.
-
setY1
public void setY1(int y)
Description copied from interface:Segment2aiChange the Y of the first point.- Specified by:
setY1in interfaceSegment2ai<Shape2i<?>,Segment2i,PathElement2i,Point2i,Vector2i,Rectangle2i>- Parameters:
y- the y of the first point.
-
setX2
public void setX2(int x)
Description copied from interface:Segment2aiChange the X of the second point.- Specified by:
setX2in interfaceSegment2ai<Shape2i<?>,Segment2i,PathElement2i,Point2i,Vector2i,Rectangle2i>- Parameters:
x- the x of the second point.
-
setY2
public void setY2(int y)
Description copied from interface:Segment2aiChange the Y of the second point.- Specified by:
setY2in interfaceSegment2ai<Shape2i<?>,Segment2i,PathElement2i,Point2i,Vector2i,Rectangle2i>- Parameters:
y- the y of the second point.
-
getX1
@Pure public int getX1()
Description copied from interface:Segment2aiReplies the X of the first point.- Specified by:
getX1in interfaceSegment2ai<Shape2i<?>,Segment2i,PathElement2i,Point2i,Vector2i,Rectangle2i>- Returns:
- the x of the first point.
-
getY1
@Pure public int getY1()
Description copied from interface:Segment2aiReplies the Y of the first point.- Specified by:
getY1in interfaceSegment2ai<Shape2i<?>,Segment2i,PathElement2i,Point2i,Vector2i,Rectangle2i>- Returns:
- the y of the first point.
-
getX2
@Pure public int getX2()
Description copied from interface:Segment2aiReplies the X of the second point.- Specified by:
getX2in interfaceSegment2ai<Shape2i<?>,Segment2i,PathElement2i,Point2i,Vector2i,Rectangle2i>- Returns:
- the x of the second point.
-
getY2
@Pure public int getY2()
Description copied from interface:Segment2aiReplies the Y of the second point.- Specified by:
getY2in interfaceSegment2ai<Shape2i<?>,Segment2i,PathElement2i,Point2i,Vector2i,Rectangle2i>- Returns:
- the y of the second point.
-
getP1
public Point2i getP1()
Description copied from interface:Segment2aiReplies the first point.- Specified by:
getP1in interfaceSegment2ai<Shape2i<?>,Segment2i,PathElement2i,Point2i,Vector2i,Rectangle2i>- Returns:
- the first point.
-
getP2
public Point2i getP2()
Description copied from interface:Segment2aiReplies the second point.- Specified by:
getP2in interfaceSegment2ai<Shape2i<?>,Segment2i,PathElement2i,Point2i,Vector2i,Rectangle2i>- Returns:
- the second point.
-
-