jitx/shapes/Point¶
Package name: jitx/shapes/Point
Summary¶
Data Types¶
Point¶
Point
Functions¶
Function | Description |
---|---|
iy | The truncated integer value of the Y coordinate of the point. |
Point | Create a point from two integer coordinates. |
min | Create the point which is the result of taking the minimum coordinate along each axis of the coordinates of a and b . |
max | Create the point which is the result of taking the maximum coordinate along each axis of the coordinates of a and b . |
get | Retrieve the X or Y coordinate of the point, using an index to select which coordinate. |
ix | The truncated integer value of the X coordinate of the point. |
Operators¶
Function | Op. | Description |
---|---|---|
minus | - |
Create the point which is the result of subtracting the coordinates of b from the coordinates of a . |
divide | / |
Create the point which is the result of dividing the coordinates of a by n . |
negate | - |
Create the point with both coordinates negated of the given point. |
plus | + |
Create the point which is the result of adding the coordinates of a and b . |
times | * |
Create the point which is the result of multiplying the coordinates of a by n . |
Centerable¶
Centerable
General Definitions¶
Definitions¶
Point¶
Point
public defstruct Point <: Shape & Centerable & HasMetaUtils :
x: Double
y: Double
-
x: Double
- X-axis coordinate of this point. -
y: Double
- Y-axis coordinate of this point.
A single 2D point with an X and a Y coordinate. A point is centerable and has zero area.
Functions¶
iy¶
The truncated integer value of the Y coordinate of the point.
public defn iy (p:Point)
Point¶
Create a point from two integer coordinates.
public defn Point (x:Int, y:Int)
min¶
Create the point which is the result of taking the minimum coordinate along each axis of the coordinates of a
and b
.
public defn min (a:Point, b:Point)
max¶
Create the point which is the result of taking the maximum coordinate along each axis of the coordinates of a
and b
.
public defn max (a:Point, b:Point)
get¶
Retrieve the X or Y coordinate of the point, using an index to select which coordinate.
public defn get (p:Point, i:Int) -> Double
p: Point
- The point to retrieve the coordinate of.i: Int
- Index to select which coordinate to retrieve (0 for X, 1 for Y).- Returns
Double
- Throws
Error
- ifi
is not 0 or 1.
Index 0 is the X coordinate, 1 is the Y coordinate.
ix¶
The truncated integer value of the X coordinate of the point.
public defn ix (p:Point)
Operators¶
minus -
¶
Create the point which is the result of subtracting the coordinates of b
from the coordinates of a
.
public defn minus (a:Point, b:Point)
divide /
¶
Create the point which is the result of dividing the coordinates of a
by n
.
public defn divide (a:Point, n:Double)
negate -
¶
Create the point with both coordinates negated of the given point.
public defn negate (a:Point)
plus +
¶
Create the point which is the result of adding the coordinates of a
and b
.
public defn plus (a:Point, b:Point)
times *
¶
Create the point which is the result of multiplying the coordinates of a
by n
.
public defn times (a:Double, b:Point)
Centerable¶
Centerable
public deftype Centerable
Shapes which are subtypes of this type have a defined center point and pose angle, which can be obtained by calling the center
and angle
functions, respectively, on the shape.
Multis¶
angle¶
public defmulti angle (sh:Centerable) -> Double
- Returns
Double
center¶
public defmulti center (sh:Centerable) -> Point
- Returns
Point
General Definitions¶
Related Packages¶
Forwarded by packages: jitx/shapes, jitx