struct Geode::Point

Overview

The Point struct represents a point on the 2-dimensional Cartesian plane.

Included Modules

Defined in:

geode/point.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(x : Number::Primitive = 0, y : Number::Primitive = 0) #

Creates a new Point.


[View source]

Class Method Detail

def self.collinear?(p1 : Point, p2 : Point, p3 : Point) #

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.


[View source]

Instance Method Detail

def ==(other : self) #

def each(&) #

Separately yields the x- and y-coordinates of the point.


[View source]
def hash(hasher) #
Description copied from struct Struct

See Object#hash(hasher)


def to_s(io : IO) #

Returns a string representation of the point in the form (x, y).


[View source]
def x : Float32 | Float64 | Int128 | Int16 | Int32 | Int64 | Int8 | UInt128 | UInt16 | UInt32 | UInt64 | UInt8 #

Returns the x-coordinate.


[View source]
def y : Float32 | Float64 | Int128 | Int16 | Int32 | Int64 | Int8 | UInt128 | UInt16 | UInt32 | UInt64 | UInt8 #

Returns the y-coordinate.


[View source]