API Docs for: 最后更新日期:2014年8月25日
Google搜索   
Show:

LPoint Class

Defined in: geom/LPoint.js:1

Available since 1.7.7

Creates a new point. The LPoint object represents a location in a two-dimensional coordinate system, where x represents the horizontal axis and y represents the vertical axis.

Constructor

LPoint

(
  • x
  • y
)
public

Defined in geom/LPoint.js:1

Available since 1.7.7

Parameters:

  • x Float

    The horizontal coordinate.

  • y Float

    The vertical coordinate.

Example:

var myPoint = new LPoint(100,100);

Item Index

Properties

Methods

add

(
  • v
)
LPoint public

Defined in geom/LPoint.js:104

Available since 1.8.5

Adds the coordinates of another point to the coordinates of this point to create a new point.

Parameters:

  • v LPoint

    The point to be added.

Returns:

LPoint:

The new point.

clone

() LPoint public

Defined in geom/LPoint.js:115

Available since 1.8.5

Creates a copy of this LPoint object.

Returns:

LPoint:

The new LPoint object.

copyFrom

(
  • sourcePoint
)
public

Defined in geom/LPoint.js:136

Available since 1.8.5

Copies all of the point data from the source LPoint object into the calling LPoint object.

Parameters:

  • sourcePoint LPoint

    The LPoint object from which to copy the data.

distance

(
  • p1
  • p2
)
Float public static

Defined in geom/LPoint.js:34

Available since 1.8.5

[static]Returns the distance between p1 and p2.

Parameters:

Returns:

Float:

The distance between the first and second points.

distance2

(
  • x1
  • y1
  • x2
  • y2
)
Float public static

Defined in geom/LPoint.js:47

Available since 1.8.5

[static]Returns the distance between p1 and p2.

Parameters:

  • x1 LPoint

    The horizontal coordinate of the first point.

  • y1 LPoint

    The vertical coordinate of the first point.

  • x2 LPoint

    2 The horizontal coordinate of the second point.

  • y2 LPoint

    2 The vertical coordinate of the second point.

Returns:

Float:

The distance between the first and second points.

equals

(
  • The
)
Boolean public

Defined in geom/LPoint.js:146

Available since 1.8.5

Determines whether two points are equal. Two points are equal if they have the same x and y values.

Parameters:

  • The LPoint

    point to be compared.

Returns:

Boolean:

A value of true if the object is equal to this Point object; false if it is not equal.

interpolate

(
  • p1
  • p2
  • f
)
LPoint public static

Defined in geom/LPoint.js:63

Available since 1.8.5

[static]Determines a point between two specified points. The parameter f determines where the new interpolated point is located relative to the two end points specified by parameters pt1 and pt2. The closer the value of the parameter f is to 1.0, the closer the interpolated point is to the first point (parameter p1). The closer the value of the parameter f is to 0, the closer the interpolated point is to the second point (parameter p2).

Parameters:

  • p1 LPoint

    The first point.

  • p2 LPoint

    The second point.

  • f Float

    The level of interpolation between the two points. Indicates where the new point will be, along the line between p1 and p2. If f=1, p1 is returned; if f=0, p2 is returned.

Returns:

LPoint:

The new, interpolated point.

length

() Float public

Defined in geom/LPoint.js:94

Available since 1.8.5

Returns the length of the line segment from (0,0) to this point.

Returns:

Float:

The length of the line segment from (0,0) to this point.

normalize

(
  • thickness
)
public

Defined in geom/LPoint.js:157

Available since 1.8.5

Scales the line segment between (0,0) and the current point to a set length.

Parameters:

  • thickness Float

    The scaling value. For example, if the current point is (0,5), and you normalize it to 1, the point returned is at (0,1).

offset

(
  • dx
  • dy
)
public

Defined in geom/LPoint.js:168

Available since 1.8.5

Offsets the LPoint object by the specified amount. The value of dx is added to the original value of x to create the new x value. The value of dy is added to the original value of y to create the new y value.

Parameters:

  • dx Float

    The amount by which to offset the horizontal coordinate, x

  • dy Float

    The amount by which to offset the vertical coordinate, y.

polar

(
  • len
  • angle
)
LPoint public static

Defined in geom/LPoint.js:77

Available since 1.8.5

[static]Converts a pair of polar coordinates to a Cartesian point coordinate.

Parameters:

  • len Float

    The length coordinate of the polar pair.

  • angle Float

    The angle, in radians, of the polar pair.

Returns:

LPoint:

The Cartesian point.

setTo

(
  • x
  • y
)
public

Defined in geom/LPoint.js:125

Available since 1.8.5

Sets the members of LPoint to the specified values

Parameters:

  • x Float

    the x values to set the point to.

  • y Float

    the y values to set the point to.

subtract

(
  • v
)
LPoint public

Defined in geom/LPoint.js:180

Available since 1.8.5

Subtracts the coordinates of another point from the coordinates of this point to create a new point.

Parameters:

  • v LPoint

    The point to be subtracted.

Returns:

LPoint:

The new point.

Properties

x

Float public

Defined in geom/LPoint.js:15

Available since 1.7.7

The horizontal coordinate of the point.

Default: 0

y

Float public

Defined in geom/LPoint.js:24

Available since 1.7.7

The vertical coordinate of the point.

Default: 0