type

Point

src @Js
@Serializable { simple=true }
const class Point : Obj

Point models a x,y coordinate.

constructors

fromStr

Parse from comma or space separated string.

make

Construct with x, y.

makeInt

Construct with x, y.

fields

defVal

Default instance is 0,0.

x

X coordinate

y

Y coordinate

methods

equals

Return if obj is same Point value.

hash

Return hash of x and y.

toStr

Return "x y"

translate

Return x+tx, y+ty

Slot Details

defVal

src const static Point defVal := Point.<ctor>(0.0, 0.0)

Default instance is 0,0.

equals

src virtual override Bool equals(Obj? obj)

Return if obj is same Point value.

fromStr

src static new fromStr(Str s, Bool checked := true)

Parse from comma or space separated string. If invalid then throw ParseErr or return null based on checked flag.

hash

src virtual override Int hash()

Return hash of x and y.

make

src new make(Float x, Float y)

Construct with x, y.

makeInt

src new makeInt(Int x, Int y)

Construct with x, y.

toStr

src virtual override Str toStr()

Return "x y"

translate

src Point translate(Point t)

Return x+tx, y+ty

x

src const Float x

X coordinate

y

src const Float y

Y coordinate