math.Line Extends
Object representing a line.

Inheritance

Constructor

goog.math.Line(x0y0x1y1)

Parameters

x0 : number
X coordinate of the start point.
y0 : number
Y coordinate of the start point.
x1 : number
X coordinate of the end point.
y1 : number
Y coordinate of the end point.

Instance Methods

Public Protected Private
Defined in goog.math.Line
clone() !goog.math.Line
No description.
Returns: !goog.math.Line  A copy of this line.
code »
equals(other) boolean
Tests whether the given line is exactly the same as this one.
Arguments:
other : goog.math.Line
The other line.
Returns: boolean  Whether the given line is the same as this one.
code »
getClosestLinearInterpolation_(xopt_y) number
Computes the interpolation parameter for the point on the line closest to a given point.
Arguments:
x : number | goog.math.Coordinate
The x coordinate of the point, or a coordinate object.
opt_y : number=
The y coordinate of the point - required if x is a number, ignored if x is a goog.math.Coordinate.
Returns: number  The interpolation parameter of the point on the line closest to the given point.
code »
getClosestPoint(xopt_y) !goog.math.Coordinate
Computes the point on the line closest to a given point. Note that a line in this case is defined as the infinite line going through the start and end points. To find the closest point on the line segment itself see .
Arguments:
x : number | goog.math.Coordinate
The x coordinate of the point, or a coordinate object.
opt_y : number=
The y coordinate of the point - required if x is a number, ignored if x is a goog.math.Coordinate.
Returns: !goog.math.Coordinate  The point on the line closest to the given point.
code »
getClosestSegmentPoint(xopt_y) !goog.math.Coordinate
Computes the point on the line segment closest to a given point.
Arguments:
x : number | goog.math.Coordinate
The x coordinate of the point, or a coordinate object.
opt_y : number=
The y coordinate of the point - required if x is a number, ignored if x is a goog.math.Coordinate.
Returns: !goog.math.Coordinate  The point on the line segment closest to the given point.
code »
getInterpolatedPoint(t) !goog.math.Coordinate
Returns the point on the line segment proportional to t, where for t = 0 we return the starting point and for t = 1 we return the end point. For t < 0 or t > 1 we extrapolate along the line defined by the line segment.
Arguments:
t : number
The interpolation parameter along the line segment.
Returns: !goog.math.Coordinate  The point on the line segment at t.
code »
getSegmentLength() number
No description.
Returns: number  The length of the line segment used to define the line.
code »
getSegmentLengthSquared() number
No description.
Returns: number  The squared length of the line segment used to define the line.
code »

Instance Properties

Defined in goog.math.Line
x0 :
X coordinate of the first point.
Code »
x1 :
X coordinate of the first control point.
Code »
y0 :
Y coordinate of the first point.
Code »
y1 :
Y coordinate of the first control point.
Code »

Package math

Package Reference