CrImage::Point
A Point represents an (x, y) coordinate on the integer grid.
Coordinate system:
- X-axis increases to the right
- Y-axis increases downward
- A Point is neither a pixel nor a grid square
- A Point has no intrinsic width, height, or color
Example:
p1 = CrImage::Point.new(10, 20)
p2 = CrImage.point(30, 40) # Factory method
p3 = p1 + p2 # Point arithmetic
Constructors
Class methods
zero
SourceInstance methods
*(o : Point)
Source+(o : Point)
Source-(o : Point)
Source/(o : Point)
Sourceeq(o : Point)
SourceReports whether this point is inside the given rectangle.
A point is considered inside if it satisfies:
r.min.x <= x < r.max.xr.min.y <= y < r.max.y
Note: The max bounds are exclusive.
mod(r : Rectangle) : Point
Returns the point q in Rectangle r such that p.x - q.x is a multiple of r's width and p.y - q.y is a multiple of r's height.
This is useful for wrapping coordinates within a rectangular region, similar to modulo arithmetic but for 2D coordinates.