org.jmol.g3d

Class Line3D

final class Line3D extends Object

Implements 3D line drawing routines.

A number of line drawing routines, most of which are used to implement higher-level shapes. Triangles and cylinders are drawn as a series of lines

Author: Miguel, miguel@jmol.org and Bob Hanson, hansonr@stolaf.edu

Field Summary
intcc1
intcc2
Graphics3Dg3d
BitSetlineBits
HashtablelineCache
booleanlineTypeX
intnBits
intnCached
intnFound
floatslope
FloatslopeKey
static intVISIBILITY_CLIPPED
static intVISIBILITY_OFFSCREEN
static intVISIBILITY_UNCLIPPED
intx1t
intx2t
static intxGT
static intxLT
inty1t
inty2t
static intyGT
static intyLT
intz1t
intz2t
static intzGT
static intzLT
Constructor Summary
Line3D(Graphics3D g3d)
Method Summary
intclipCode(int x, int y, int z)
booleangetCachedLine()
intgetTrimmedLine()

Cohen-Sutherland line clipping used to check visibility.

voidplotDashedLine(int argb, boolean tScreened, int run, int rise, int xA, int yA, int zA, int xB, int yB, int zB, boolean notClipped)
voidplotLine(int argbA, boolean tScreenedA, int argbB, boolean tScreenedB, int xA, int yA, int zA, int xB, int yB, int zB, boolean notClipped)
voidplotLineClipped(int argb1, boolean tScreened1, int argb2, boolean tScreened2, int x, int y, int z, int dx, int dy, int dz, boolean notClipped, int run, int rise)
voidplotLineClipped(int[] shades1, boolean tScreened1, int[] shades2, boolean tScreened2, int intensity, int x, int y, int z, int dx, int dy, int dz, boolean notClipped, int run, int rise)
voidplotLineClippedBits(int[] shades1, boolean tScreened1, int[] shades2, boolean tScreened2, int intensity, int x, int y, int z, int dx, int dy, int dz, boolean notClipped, int run, int rise)
voidplotLineDelta(int argbA, boolean tScreenedA, int argbB, boolean tScreenedB, int xA, int yA, int zA, int dxBA, int dyBA, int dzBA, boolean notClipped)
voidplotLineDelta(int[] shades1, boolean tScreened1, int[] shades2, boolean tScreened2, int intensity, int xA, int yA, int zA, int dxBA, int dyBA, int dzBA, boolean notClipped)
voidplotLineDeltaBits(int[] shades1, boolean tScreened1, int[] shades2, boolean tScreened2, int intensity, int xA, int yA, int zA, int dxBA, int dyBA, int dzBA, boolean notClipped)
voidsetLineBits(float dx, float dy)

Field Detail

cc1

int cc1

cc2

int cc2

g3d

Graphics3D g3d

lineBits

BitSet lineBits

lineCache

Hashtable lineCache

lineTypeX

boolean lineTypeX

nBits

int nBits

nCached

int nCached

nFound

int nFound

slope

float slope

slopeKey

Float slopeKey

VISIBILITY_CLIPPED

static final int VISIBILITY_CLIPPED

VISIBILITY_OFFSCREEN

static final int VISIBILITY_OFFSCREEN

VISIBILITY_UNCLIPPED

static final int VISIBILITY_UNCLIPPED

x1t

int x1t

x2t

int x2t

xGT

static final int xGT

xLT

static final int xLT

y1t

int y1t

y2t

int y2t

yGT

static final int yGT

yLT

static final int yLT

z1t

int z1t

z2t

int z2t

zGT

static final int zGT

zLT

static final int zLT

Constructor Detail

Line3D

Line3D(Graphics3D g3d)

Method Detail

clipCode

final int clipCode(int x, int y, int z)

getCachedLine

boolean getCachedLine()

getTrimmedLine

int getTrimmedLine()

Cohen-Sutherland line clipping used to check visibility.

Note that this routine is only used for visibility checking. To avoid integer rounding errors which cause cracking to occur in 'solid' surfaces, the lines are actually drawn from their original end-points. The nuance is that this algorithm doesn't just deliver a boolean. It delivers the trimmed line. Although we need to start the raster loop at the origin for good surfaces, we can save lots of time by saving the known endpoints as globals variables. -- Bob Hanson 7/06

Returns: Visibility (see VISIBILITY_... constants);

plotDashedLine

void plotDashedLine(int argb, boolean tScreened, int run, int rise, int xA, int yA, int zA, int xB, int yB, int zB, boolean notClipped)

plotLine

void plotLine(int argbA, boolean tScreenedA, int argbB, boolean tScreenedB, int xA, int yA, int zA, int xB, int yB, int zB, boolean notClipped)

plotLineClipped

private void plotLineClipped(int argb1, boolean tScreened1, int argb2, boolean tScreened2, int x, int y, int z, int dx, int dy, int dz, boolean notClipped, int run, int rise)

plotLineClipped

private void plotLineClipped(int[] shades1, boolean tScreened1, int[] shades2, boolean tScreened2, int intensity, int x, int y, int z, int dx, int dy, int dz, boolean notClipped, int run, int rise)

plotLineClippedBits

private void plotLineClippedBits(int[] shades1, boolean tScreened1, int[] shades2, boolean tScreened2, int intensity, int x, int y, int z, int dx, int dy, int dz, boolean notClipped, int run, int rise)

plotLineDelta

void plotLineDelta(int argbA, boolean tScreenedA, int argbB, boolean tScreenedB, int xA, int yA, int zA, int dxBA, int dyBA, int dzBA, boolean notClipped)

plotLineDelta

void plotLineDelta(int[] shades1, boolean tScreened1, int[] shades2, boolean tScreened2, int intensity, int xA, int yA, int zA, int dxBA, int dyBA, int dzBA, boolean notClipped)

plotLineDeltaBits

void plotLineDeltaBits(int[] shades1, boolean tScreened1, int[] shades2, boolean tScreened2, int intensity, int xA, int yA, int zA, int dxBA, int dyBA, int dzBA, boolean notClipped)

setLineBits

void setLineBits(float dx, float dy)