struct Geode::Point
- Geode::Point
- Struct
- Value
- Object
Overview
The Point
struct represents a point on the 2-dimensional Cartesian plane.
Included Modules
- Enumerable(Float32 | Float64 | Int128 | Int16 | Int32 | Int64 | Int8 | UInt128 | UInt16 | UInt32 | UInt64 | UInt8)
Defined in:
geode/point.crConstructors
-
.new(x : Number::Primitive = 0, y : Number::Primitive = 0)
Creates a new
Point
.
Class Method Summary
-
.collinear?(p1 : Point, p2 : Point, p3 : Point)
Returns whether or not the three given points are collinear, i.e.
Instance Method Summary
- #==(other : self)
-
#each(&)
Separately yields the x- and y-coordinates of the point.
-
#hash(hasher)
See
Object#hash(hasher)
-
#to_s(io : IO)
Returns a string representation of the point in the form
(x, y)
. -
#x : Float32 | Float64 | Int128 | Int16 | Int32 | Int64 | Int8 | UInt128 | UInt16 | UInt32 | UInt64 | UInt8
Returns the x-coordinate.
-
#y : Float32 | Float64 | Int128 | Int16 | Int32 | Int64 | Int8 | UInt128 | UInt16 | UInt32 | UInt64 | UInt8
Returns the y-coordinate.
Constructor Detail
Creates a new Point
.
Class Method Detail
Returns whether or not the three given points are collinear, i.e. whether a straight line could be drawn that passes through all three points.
Instance Method Detail
def x : Float32 | Float64 | Int128 | Int16 | Int32 | Int64 | Int8 | UInt128 | UInt16 | UInt32 | UInt64 | UInt8
#
Returns the x-coordinate.
def y : Float32 | Float64 | Int128 | Int16 | Int32 | Int64 | Int8 | UInt128 | UInt16 | UInt32 | UInt64 | UInt8
#
Returns the y-coordinate.