- java.lang.Object
-
- org.arakhne.afc.math.geometry.d2.d.AbstractShape2d<Triangle2d>
-
- org.arakhne.afc.math.geometry.d2.d.Triangle2d
-
- All Implemented Interfaces:
Serializable,Cloneable,Shape2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>,Triangle2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>,Shape2d<Triangle2d>,Shape2D<Shape2d<?>,Triangle2d,PathIterator2afp<PathElement2d>,Point2d,Vector2d,Rectangle2d>,JsonableObject
public class Triangle2d extends AbstractShape2d<Triangle2d> implements Triangle2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>
A triangle with 2 double precision floating-point 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.afp.Triangle2afp
Triangle2afp.AbstractTrianglePathIterator<T extends PathElement2afp>, Triangle2afp.TransformedTrianglePathIterator<T extends PathElement2afp>, Triangle2afp.TriangleFeature, Triangle2afp.TrianglePathIterator<T extends PathElement2afp>
-
-
Constructor Summary
Constructors Constructor Description Triangle2d()Construct an empty triangle.Triangle2d(double x1, double y1, double x2, double y2, double x3, double y3)Construct a triangle with the given 3 points.Triangle2d(Triangle2afp<?,?,?,?,?,?> t)Construct a triangle from a triangle.Triangle2d(Point2D<?,?> p1, Point2D<?,?> p2, Point2D<?,?> p3)Construct a triangle with the given 3 points.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Triangle2dcreateTransformedShape(Transform2D transform)Apply the transformation to the shape and reply the result.doublegetX1()Replies the first point X.doublegetX2()Replies the second point X.doublegetX3()Replies the third point X.doublegetY1()Replies the first point Y.doublegetY2()Replies the second point Y.doublegetY3()Replies the third point Y.inthashCode()booleanisCCW()Replies if the points of the triangle are defined in a counter-clockwise order.voidset(double x1, double y1, double x2, double y2, double x3, double y3)Change the triangle.voidsetX1(double x)Change the x coordinate of the first point.voidsetX2(double x)Change the x coordinate of the second point.voidsetX3(double x)Change the x coordinate of the third point.voidsetY1(double y)Change the y coordinate of the first point.voidsetY2(double y)Change the y coordinate of the second point.voidsetY3(double y)Change the y coordinate of the third point.-
Methods inherited from class org.arakhne.afc.math.geometry.d2.d.AbstractShape2d
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.afp.Shape2afp
contains, contains, getClosestPointTo, getClosestPointTo, getDistanceSquared, 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
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.afp.Triangle2afp
clear, contains, contains, equalsToShape, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getClosestPointTo, getDistanceL1, getDistanceLinf, getDistanceSquared, getFarthestPointTo, getP1, getP2, getP3, getPathIterator, intersects, intersects, intersects, intersects, intersects, intersects, intersects, intersects, intersects, intersects, isEmpty, set, setP1, setP1, setP2, setP2, setP3, setP3, toBoundingBox, translate
-
-
-
-
Constructor Detail
-
Triangle2d
public Triangle2d()
Construct an empty triangle.
-
Triangle2d
public Triangle2d(Point2D<?,?> p1, Point2D<?,?> p2, Point2D<?,?> p3)
Construct a triangle with the given 3 points.- Parameters:
p1- first point.p2- second point.p3- third point.
-
Triangle2d
public Triangle2d(double x1, double y1, double x2, double y2, double x3, double y3)Construct a triangle with the given 3 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.x3- x coordinate of the third point.y3- y coordinate of the third point.
-
Triangle2d
public Triangle2d(Triangle2afp<?,?,?,?,?,?> t)
Construct a triangle from a triangle.- Parameters:
t- the triangle to copy.
-
-
Method Detail
-
hashCode
@Pure public int hashCode()
- Specified by:
hashCodein classAbstractShape2d<Triangle2d>
-
createTransformedShape
@Pure public Triangle2d 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<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Specified by:
createTransformedShapein interfaceShape2D<Shape2d<?>,Triangle2d,PathIterator2afp<PathElement2d>,Point2d,Vector2d,Rectangle2d>- Parameters:
transform- is the transformation to apply to the shape.- Returns:
- the result of the transformation.
-
getX1
public double getX1()
Description copied from interface:Triangle2afpReplies the first point X.- Specified by:
getX1in interfaceTriangle2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Returns:
- the first point x.
-
getY1
public double getY1()
Description copied from interface:Triangle2afpReplies the first point Y.- Specified by:
getY1in interfaceTriangle2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Returns:
- the first point y.
-
getX2
public double getX2()
Description copied from interface:Triangle2afpReplies the second point X.- Specified by:
getX2in interfaceTriangle2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Returns:
- the second point x.
-
getY2
public double getY2()
Description copied from interface:Triangle2afpReplies the second point Y.- Specified by:
getY2in interfaceTriangle2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Returns:
- the second point y.
-
getX3
public double getX3()
Description copied from interface:Triangle2afpReplies the third point X.- Specified by:
getX3in interfaceTriangle2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Returns:
- the third point x.
-
getY3
public double getY3()
Description copied from interface:Triangle2afpReplies the third point Y.- Specified by:
getY3in interfaceTriangle2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Returns:
- the third point y.
-
setX1
public void setX1(double x)
Description copied from interface:Triangle2afpChange the x coordinate of the first point.- Specified by:
setX1in interfaceTriangle2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Parameters:
x- x coordinate of the point.
-
setY1
public void setY1(double y)
Description copied from interface:Triangle2afpChange the y coordinate of the first point.- Specified by:
setY1in interfaceTriangle2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Parameters:
y- y coordinate of the point.
-
setX2
public void setX2(double x)
Description copied from interface:Triangle2afpChange the x coordinate of the second point.- Specified by:
setX2in interfaceTriangle2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Parameters:
x- x coordinate of the point.
-
setY2
public void setY2(double y)
Description copied from interface:Triangle2afpChange the y coordinate of the second point.- Specified by:
setY2in interfaceTriangle2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Parameters:
y- y coordinate of the point.
-
setX3
public void setX3(double x)
Description copied from interface:Triangle2afpChange the x coordinate of the third point.- Specified by:
setX3in interfaceTriangle2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Parameters:
x- x coordinate of the point.
-
setY3
public void setY3(double y)
Description copied from interface:Triangle2afpChange the y coordinate of the third point.- Specified by:
setY3in interfaceTriangle2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Parameters:
y- y coordinate of the point.
-
set
public void set(double x1, double y1, double x2, double y2, double x3, double y3)Description copied from interface:Triangle2afpChange the triangle.- Specified by:
setin interfaceTriangle2afp<Shape2d<?>,Triangle2d,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.x3- x coordinate of the third point.y3- y coordinate of the third point.
-
isCCW
public boolean isCCW()
Description copied from interface:Triangle2afpReplies if the points of the triangle are defined in a counter-clockwise order.- Specified by:
isCCWin interfaceTriangle2afp<Shape2d<?>,Triangle2d,PathElement2d,Point2d,Vector2d,Rectangle2d>- Returns:
trueif the triangle points are defined in a counter-clockwise order.
-
-