public class MeshCapper
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private class |
MeshCapper.CapVertex
A class to provide linked vertices for MeshCapper
|
class |
MeshCapper.MeshCapperSorter |
| Modifier and Type | Field and Description |
|---|---|
private static int |
ASCENDER |
private java.util.Map<java.lang.Integer,MeshCapper.CapVertex> |
capMap
initialization only
|
private static int |
DESCENDER |
private boolean |
dumping
for debugging
|
private static int |
LAST |
private javajs.util.Lst<MeshCapper.CapVertex[]> |
lstRegions
dynamic region processing.
|
private javajs.util.Lst<int[]> |
lstTriangles |
(package private) javajs.util.M3 |
m3 |
(package private) javajs.util.M3 |
m3inv |
private int |
nPoints |
private int |
nRegions
informational only
|
private int |
nTriangles
informational only
|
private MeshSlicer |
slicer
source of edges; consumer of triangles
|
private javajs.util.Lst<MeshCapper.CapVertex> |
vertices |
| Constructor and Description |
|---|
MeshCapper() |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
addEdge(int ipt1,
int ipt2,
int thisSet)
Input method from MeshSlicer.
|
private MeshCapper.CapVertex |
addPoint(int thisSet,
int i)
The MeshSlicer class manages all introduction of vertices; we must pass on
to it the subset of vertices from the original Jmol isosurface being
capped.
|
private void |
addTriangle(MeshCapper.CapVertex v0,
MeshCapper.CapVertex v1,
MeshCapper.CapVertex v2,
java.lang.String note)
Add the triangle and remove v1 from the chain.
|
private boolean |
checkWinding(MeshCapper.CapVertex v0,
MeshCapper.CapVertex v1,
MeshCapper.CapVertex v2)
Check for CCW winding.
|
(package private) void |
clear() |
private static void |
clearV(MeshCapper.CapVertex v) |
(package private) void |
createCap(javajs.util.V3 norm)
Entry point when finished generating edges.
|
private void |
drawTriangle(int index,
MeshCapper.CapVertex v0,
MeshCapper.CapVertex v1,
MeshCapper.CapVertex v2,
java.lang.String color)
for debugging
|
private MeshCapper.CapVertex |
findNearestVertex(javajs.util.Lst<MeshCapper.CapVertex> v1s,
MeshCapper.CapVertex v0)
Find the nearest vertex to v0 in the list v1s.
|
private void |
fixEndsAndSortVertices(MeshCapper.CapVertex[] vs)
Generate yxNext links based on scanning Y large to small and if Y1==Y2,
then X small to large
|
private javajs.util.T3 |
getInputPoint(MeshCapper.CapVertex v)
for debugging
|
private MeshCapper.CapVertex |
getLastPoint(MeshCapper.CapVertex v)
Find the lowest ascender or descender above scan line bounding the region
for this point.
|
private boolean |
isEdge(int i,
int j) |
private void |
newRegion(MeshCapper.CapVertex v)
Add a new region to the list of regions.
|
private void |
outputTriangle(int ipt1,
int ipt2,
int ipt3)
Export triangle to MeshSlicer
|
private MeshCapper.CapVertex |
process(MeshCapper.CapVertex v)
Handle the point; mark as processed.
|
private void |
processMonotonic(MeshCapper.CapVertex v,
boolean isDescending)
Process a standard monotonic region, cleaving off as many triangles as
possible.
|
private MeshCapper.CapVertex |
processSplit(MeshCapper.CapVertex v,
MeshCapper.CapVertex last)
Process what M3O refer to as a "split" vertex, which we handle differently
here, cloning the "helper" point and the "split" point, creating a new
region if necessary, and then swapping pointers.
|
MeshCapper |
set(MeshSlicer slicer) |
int[][] |
triangulateFaces(int[][] faces,
javajs.util.P3[] vertices,
int[][] faceTriangles)
generic entry for a set of faces
|
int[][] |
triangulatePolygon(javajs.util.P3[] points,
int nPoints)
generic entry for a polygon
|
private MeshSlicer slicer
private boolean dumping
private java.util.Map<java.lang.Integer,MeshCapper.CapVertex> capMap
private javajs.util.Lst<MeshCapper.CapVertex> vertices
private javajs.util.Lst<MeshCapper.CapVertex[]> lstRegions
private static final int DESCENDER
private static final int ASCENDER
private static final int LAST
private int nTriangles
private int nRegions
private javajs.util.Lst<int[]> lstTriangles
private int nPoints
javajs.util.M3 m3
javajs.util.M3 m3inv
public MeshCapper set(MeshSlicer slicer)
slicer - void clear()
public int[][] triangulateFaces(int[][] faces,
javajs.util.P3[] vertices,
int[][] faceTriangles)
faces - array of pointers into pointsvertices - faceTriangles - optional return list by facepublic int[][] triangulatePolygon(javajs.util.P3[] points,
int nPoints)
points - nPoints - number of points or -1void addEdge(int ipt1,
int ipt2,
int thisSet)
ipt1 - ipt2 - thisSet - private MeshCapper.CapVertex addPoint(int thisSet, int i)
thisSet - i - private javajs.util.T3 getInputPoint(MeshCapper.CapVertex v)
v - private void outputTriangle(int ipt1,
int ipt2,
int ipt3)
ipt1 - ipt2 - ipt3 - private boolean isEdge(int i,
int j)
void createCap(javajs.util.V3 norm)
norm - private void fixEndsAndSortVertices(MeshCapper.CapVertex[] vs)
vs - private MeshCapper.CapVertex findNearestVertex(javajs.util.Lst<MeshCapper.CapVertex> v1s, MeshCapper.CapVertex v0)
v1s - v0 - private MeshCapper.CapVertex process(MeshCapper.CapVertex v)
v - private static void clearV(MeshCapper.CapVertex v)
private void processMonotonic(MeshCapper.CapVertex v, boolean isDescending)
v - isDescending - private MeshCapper.CapVertex processSplit(MeshCapper.CapVertex v, MeshCapper.CapVertex last)
v - last - "helper" or left edgeprivate void newRegion(MeshCapper.CapVertex v)
v - private MeshCapper.CapVertex getLastPoint(MeshCapper.CapVertex v)
v - private boolean checkWinding(MeshCapper.CapVertex v0, MeshCapper.CapVertex v1, MeshCapper.CapVertex v2)
v0 - v1 - v2 - private void addTriangle(MeshCapper.CapVertex v0, MeshCapper.CapVertex v1, MeshCapper.CapVertex v2, java.lang.String note)
v0 - v1 - v2 - note - private void drawTriangle(int index,
MeshCapper.CapVertex v0,
MeshCapper.CapVertex v1,
MeshCapper.CapVertex v2,
java.lang.String color)
index - v0 - v1 - v2 - color -