Package edu.cnu.mdi.mdi3D.item3D
Class Line3D
java.lang.Object
edu.cnu.mdi.mdi3D.item3D.Item3D
edu.cnu.mdi.mdi3D.item3D.Line3D
- Direct Known Subclasses:
Axis3D
A single straight line segment between two endpoints in world coordinates.
Also caches the segment length and unit direction vector, used by
subclasses (e.g.
Axis3D) to extend or shorten the drawn line
relative to its defining endpoints.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final float[]protected final float[]protected final double[]final doubleFields inherited from class edu.cnu.mdi.mdi3D.item3D.Item3D
_panel3D, FILLALPHA, FILLCOLOR, FONT, LINE_WIDTH, LINEALPHA, LINECOLOR, TEXT_COLOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(com.jogamp.opengl.GLAutoDrawable drawable) The custom drawing methodvoidextendedPoint(int whichEnd, float amount, float[] coords) Compute a point beyond one endpoint, along the line's direction.float[]A representative point for transparent sorting, in world coordinates.floatgetX0()Get the x coordinate of the startfloatgetX1()Get the x coordinate of the endfloatgetY0()Get the y coordinate of the startfloatgetY1()Get the y coordinate of the endfloatgetZ0()Get the z coordinate of the startfloatgetZ1()Get the z coordinate of the endstatic voidlineItemTest(Panel3D p3D, int n) Add many lines to see how it handles themMethods inherited from class edu.cnu.mdi.mdi3D.item3D.Item3D
addChild, defaultProperties, dispose, disposeItem, drawItem, get, getChildren, getColor, getFillAlpha, getFillColor, getFloat, getFont, getFont, getInt, getLineAlpha, getLineColor, getLineWidth, getPanel3D, getParent, getString, getTextColor, isVisible, put, removeChild, setAlphaOfColor, setFillAlpha, setFillColor, setFont, setLineAlpha, setLineColor, setLineWidth, setTextColor, setVisible
-
Field Details
-
_p0
protected final float[] _p0 -
_p1
protected final float[] _p1 -
_unitVector
protected final double[] _unitVector -
length
public final double length
-
-
Constructor Details
-
Line3D
Create a simple 3D Line item for use on a Panel3D.- Parameters:
panel3D- the owner 3D panelp0- one end point as [x, y, z]p1- other end point as [x, y, z]color- the colorlineWidth- the line width
-
Line3D
public Line3D(Panel3D panel3D, float x1, float y1, float z1, float x2, float y2, float z2, Color color, float lineWidth) Create a simple 3D Line item for use on a Panel3D.- Parameters:
panel3D- the owner 3D panelx1- x coordinate of one endy1- y coordinate of one endz1- z coordinate of one endx2- x coordinate of other endy2- y coordinate of other endz2- z coordinate of other endcolor- the colorlineWidth- the line width
-
Line3D
Create a simple 3D Line item for use on a Panel3D.- Parameters:
panel3D- the owner 3D panelcoords- the endpoints as [x1, y1, z1, x2, y2, z2]color- the colorlineWidth- the line width
-
-
Method Details
-
draw
public void draw(com.jogamp.opengl.GLAutoDrawable drawable) Description copied from class:Item3DThe custom drawing method -
getX0
public float getX0()Get the x coordinate of the start- Returns:
- x coordinate of the start
-
getX1
public float getX1()Get the x coordinate of the end- Returns:
- x coordinate of the end
-
getY0
public float getY0()Get the y coordinate of the start- Returns:
- y coordinate of the start
-
getY1
public float getY1()Get the y coordinate of the end- Returns:
- y coordinate of the end
-
getZ0
public float getZ0()Get the z coordinate of the start- Returns:
- z coordinate of the start
-
getZ1
public float getZ1()Get the z coordinate of the end- Returns:
- z coordinate of the end
-
lineItemTest
Add many lines to see how it handles them- Parameters:
p3D- the paneln- the number to add
-
extendedPoint
public void extendedPoint(int whichEnd, float amount, float[] coords) Compute a point beyond one endpoint, along the line's direction.- Parameters:
whichEnd- which endpoint to extend from:0extends pastp0away fromp1; any other value extends pastp1away fromp0amount- distance to extend by, in world unitscoords- destination array, filled with the extended point as[x, y, z]; must have length at least 3
-
getSortPoint
public float[] getSortPoint()Description copied from class:Item3DA representative point for transparent sorting, in world coordinates. Default is origin. Override in items with a natural center (Sphere, Cube, Cylinder, etc.).- Overrides:
getSortPointin classItem3D- Returns:
- the sort point as
[x, y, z]
-