Class c3dl.Line
c3dl.Line represents a line segment in 3D space. The beginning and ending
coordinates have their own color. If the beginning and ending colors are different,
the line will be drawn with a gradient color change.
The default color of the line is black and the default coordinates
are both [0,0,0], which results in the line not being rendered.The default width
is 1 pixel.
Defined in: line.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Method Attributes | Method Name and Description |
|---|---|
|
Get beginning and ending colors of the line.
|
|
|
Get the beginning and ending coordinates.
|
|
|
getWidth()
Get the width the line in pixels.
|
|
|
Get the visibility of the line.
|
|
|
setColors(beginColor, endColor)
Set the color of each end of the line.
|
|
|
setCoordinates(beginCoord, endCoord)
Set the begin and end coordinates.
|
|
|
setVisible(visible)
Set the line's visibility.
|
|
|
setWidth(width)
Set the width the line in pixels.
|
Method Detail
{Array}
getColors()
Get beginning and ending colors of the line.
- Returns:
- {Array} Array of 6 values. First 3 represent beginning color, last 3 represent ending color in the order [r,g,b].
{Array}
getCoordinates()
Get the beginning and ending coordinates.
- Returns:
- {Array} Array of 6 values. first 3 values represent the coordinates of the beginning of the line. The last 3 values represent the coordinates of the end of the line in the order [x,y,z].
getObjectType()
{float}
getWidth()
Get the width the line in pixels.
- Returns:
- {float} The width of the line in pixels.
{bool}
isVisible()
Get the visibility of the line.
- Returns:
- {bool} true if the line is rendered, otherwise false.
setColors(beginColor, endColor)
Set the color of each end of the line. A line can rendered using a solid color (by assigning
both ends of the line the same color), or a color gradient from beginColor and endColor.
The beginColor sets the color of the first coordinate of the line. The endColor sets the
end coordinate of the line. The rendered pixels in between transition from one color to
the other.
- Parameters:
- {Array} beginColor
- An array of 3 values in the order [r,g,b]. Each component must range from 0.0 to 1.0.
- {Array} endColor
- An array of 3 values in the order [r,g,b]. Each component must range from 0.0 to 1.0.
setCoordinates(beginCoord, endCoord)
Set the begin and end coordinates.
- Parameters:
- {Array} beginCoord
- Array of 3 values in the order [x,y,z], where the line segment begins.
- {Array} endCoord
- Array of 3 values in the order [x,y,z], where the line segment ends.
setVisible(visible)
Set the line's visibility.
- Parameters:
- {bool} visible
- true if the line should be rendered.
setWidth(width)
Set the width the line in pixels. A line width of 1 is guaranteed to be supported.
However, the maximum supported width for lines is implementation dependent. To get the
maximum supported line width, call Renderer's getMaxLineWidth() once the scene and renderer
have been initialized.
- Parameters:
- {float} width
- Specified in pixels. Must be at least 1. Will be rounded to the nearest integer.