cpr.geometry.Point

Abstracts a point within a two-dimensional Cartesian coordinate system.

Index

Properties
Name Type Description
x Number x coordinate
y Number y coordinate
Methods
Name Return Type Description
fromEvent Point Get a Point from the event.
fromTouch Point Get a Point from the touch event.
equals Boolean Compares whether the value is the same as another point.
getCopy Point Get a copy object.
getDifference Dimension You get the difference from other points.
getDistance Number Get the distance to another point.
getNegated Point Get a copy of the coordinates inverted relative to the origin.
getScaled Point I get a scaled copy object.
getTranslated Point You get a copy of the axis shifted.
getTranslatedByDimension Point Returns a new object changed through a Dimension object.
getTranslatedByPoint Point Returns a new object that has changed through a Point object.
getTransposed Point You get a copy with the axis reversed.
negate Point Invert based on the origin.
scale Point Apply scale based on origin.
translate Point The axis moves this coordinate by the given value.
translateByDimension Point The position value is changed by summing the width and height of the Dimension object.
translateByPoint Point Changes the position value by summing the x,y of the Point object.
transpose Point Invert the x-axis and y-axis.

Constructor

Point(x, y)
Create a new location object.
Parameters
name type description
x Number x-coordinate value.
y Number y-coordinate value.

Properties

x
type Number
x coordinate
y
type Number
y coordinate

Methods

fromEvent(e, coordinate)
Get a Point from the event.
Parameters
name type description
e UIEvent
coordinateoptional LocationCooridnate default"page" Coordinate system
return Point
fromTouch(e, coordinate)
Get a Point from the touch event.
Parameters
name type description
e Touch
coordinateoptional LocationCooridnate default"page"
return Point
equals(other, tolerance)
Compares whether the value is the same as another point.
Parameters
name type description
other Point Another point.
toleranceoptional Number default0 tolerance.
return Boolean
getCopy()
Get a copy object.
return Point
getDifference(p)
You get the difference from other points.
Parameters
name type description
p Point Different points to get the difference.
return Dimension
getDistance(p)
Get the distance to another point.
Parameters
name type description
p Point Another point to get distance.
return Number
getNegated()
Get a copy of the coordinates inverted relative to the origin.
return Point
getScaled(xFactor, yFactor)
I get a scaled copy object.
Parameters
name type description
xFactor Number x-axis scale
yFactoroptional Number defaultundefined y-axis scale, if omitted, y-axis scale value is used.
return Point
getTranslated(delta)
You get a copy of the axis shifted.
Parameters
name type description
delta Point Amount of axis travel.
return Point
getTranslated(delta)
You get a copy of the axis shifted.
Parameters
name type description
delta Dimension Amount of axis travel.
return Point
getTranslated(dx, dy)
You get a copy of the axis shifted.
Parameters
name type description
dx Number x-axis travel amount.
dy Number y-axis travel amount.
return Point
getTranslatedByDimension(d)
deprecatedPlease use getTranslated.
Returns a new object changed through a Dimension object.
Parameters
name type description
d Dimension
return Point
getTranslatedByPoint(d)
deprecatedPlease use getTranslated.
Returns a new object that has changed through a Point object.
Parameters
name type description
d Point
return Point
getTransposed()
You get a copy with the axis reversed.
return Point
negate()
Invert based on the origin.
return Point
scale(xFactor, yFactor)
Apply scale based on origin.
Parameters
name type description
xFactor Number x-axis scale
yFactoroptional Number defaultundefined The y-axis scale, if omitted, the x-axis scale value is used.
return Point
translate(delta)
The axis moves this coordinate by the given value.
Parameters
name type description
delta Dimension Movement
return Point
translate(delta)
The axis moves this coordinate by the given value.
Parameters
name type description
delta Point Movement
return Point
translate(dx, dy)
The axis moves this coordinate by the given value.
Parameters
name type description
dx Number x-axis travel amount.
dy Number y-axis travel amount.
return Point
translateByDimension(d)
deprecatedPlease use translate.
The position value is changed by summing the width and height of the Dimension object.
Parameters
name type description
d Dimension
return Point
translateByPoint(d)
deprecatedPlease use translate.
Changes the position value by summing the x,y of the Point object.
Parameters
name type description
d Point
return Point
transpose()
Invert the x-axis and y-axis.
return Point