Class: Quadrilateral<T>
Represents a polygon with four sides and four corners.
Type Parameters
T
T extends Point
Implements
Cloneable<Quadrilateral<T>>
Constructors
Constructor
new Quadrilateral<
T>(p1,p2,p3,p4):Quadrilateral<T>
Creates a new Quadrilateral instance with the specified corner coordinates.
Accepts Point instances for each corner.
Parameters
p1
T
The Point representing the first corner.
p2
T
The Point representing the second corner.
p3
T
The Point representing the third corner.
p4
T
The Point representing the fourth corner.
Returns
Quadrilateral<T>
Constructor
new Quadrilateral<
T>(x1,y1,x2,y2,x3,y3,x4,y4):Quadrilateral<T>
Creates a new Quadrilateral instance with the specified corner coordinates.
Parameters
x1
number
The X coordinate of the first corner.
y1
number
The Y coordinate of the first corner.
x2
number
The X coordinate of the second corner.
y2
number
The Y coordinate of the second corner.
x3
number
The X coordinate of the third corner.
y3
number
The Y coordinate of the third corner.
x4
number
The X coordinate of the fourth corner.
y4
number
The Y coordinate of the fourth corner.
Returns
Quadrilateral<T>
Properties
p1
p1:
T
The Point representing the first corner.
p2
p2:
T
The Point representing the second corner.
p3
p3:
T
The Point representing the third corner.
p4
p4:
T
The Point representing the fourth corner.
Accessors
points
Get Signature
get points():
T[]
Returns
T[]
Methods
clone()
clone():
Quadrilateral<T>
Creates a deep copy of the object.
Returns
Quadrilateral<T>
A new instance that is a deep copy of the original object.
Implementation of
containsPoint()
containsPoint(
p):boolean
Checks if a given point is inside the quadrilateral.
Parameters
p
T
The point to check, which is of type T extending Point.
Returns
boolean
true if the point is inside the quadrilateral, otherwise false.