Package draw
Class Block3D
java.lang.Object
draw.Block3D
- All Implemented Interfaces:
Serializable
,Comparable<Block3D>
Internal class for a 3D block.
- Since:
- 2004.06.05
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBlock3D
(double x, double y, double z, double w, double d, double h) Create a 3D block. -
Method Summary
Modifier and TypeMethodDescriptionint
Compare the depth of the projections of two blocks.double
Get the height of the block.boolean
Check whether the back side of the block is visible.boolean
Check whether the bottom side of the block is visible.boolean
Check whether the front side of the block is visible.boolean
Check whether the left side of the block is visible.boolean
Check whether the right side of the block is visible.boolean
Check whether the top side of the block is visible.void
Draw a label on a block.void
Paint a block.void
Project the block to 2D.
-
Constructor Details
-
Block3D
public Block3D(double x, double y, double z, double w, double d, double h) Create a 3D block.- Parameters:
x
- the x-coordinate of the lower left cornery
- the y-coordinate of the lower left cornerz
- the z-coordinate of the lower left cornerw
- the width of the blockd
- the depth of the blockh
- the height of the block- Since:
- 2004.06.05 (Christian Borgelt)
-
-
Method Details
-
project
Project the block to 2D.The projection is stored internally and is used when the block is to be drawn.
- Parameters:
proj
- the 3D to 2D projection to use- Since:
- 2004.06.05 (Christian Borgelt)
-
isLeftVisible
public boolean isLeftVisible()Check whether the left side of the block is visible.- Returns:
- whether the left side of the block is visible
- Since:
- 2004.06.05 (Christian Borgelt)
-
isFrontVisible
public boolean isFrontVisible()Check whether the front side of the block is visible.- Returns:
- whether the front side of the block is visible
- Since:
- 2004.06.05 (Christian Borgelt)
-
isBottomVisible
public boolean isBottomVisible()Check whether the bottom side of the block is visible.- Returns:
- whether the bottom side of the block is visible
- Since:
- 2004.06.05 (Christian Borgelt)
-
isRightVisible
public boolean isRightVisible()Check whether the right side of the block is visible.- Returns:
- whether the right side of the block is visible
- Since:
- 2004.06.05 (Christian Borgelt)
-
isBackVisible
public boolean isBackVisible()Check whether the back side of the block is visible.- Returns:
- whether the back side of the block is visible
- Since:
- 2004.06.05 (Christian Borgelt)
-
isTopVisible
public boolean isTopVisible()Check whether the top side of the block is visible.- Returns:
- whether the top side of the block is visible
- Since:
- 2004.06.05 (Christian Borgelt)
-
getHeight
public double getHeight()Get the height of the block.- Returns:
- the height of the block
- Since:
- 2013.11.26 (Christian Borgelt)
-
compareTo
Compare the depth of the projections of two blocks.- Specified by:
compareTo
in interfaceComparable<Block3D>
- Parameters:
obj
- the block to compare to- Returns:
- -1, if this block is nearer to the eye,
+1, if this block is farther from the eye,
0, if both blocks have the same (minimum) distance - Since:
- 2004.06.05 (Christian Borgelt)
-
paint
Paint a block.- Parameters:
g
- the graphics to use for the drawingcolors
- the colors to use for the different sides- Since:
- 2004.06.05 (Christian Borgelt)
-
label
Draw a label on a block.- Parameters:
g
- the graphics to use for the drawingfont
- the font to use for the texts
- the string to label the block with- Since:
- 2004.06.05 (Christian Borgelt)
-