Package mgui.morph.sections
Class MorphEngine
java.lang.Object
mgui.morph.sections.MorphEngine
public class MorphEngine
extends java.lang.Object
Engine class implementing algorithms to create polygons which represent the intermediate
positions of a morphing between two polygons on adjacent sections. The algorithm is
essentially:
- Given a section set, filter that set for instances of Polygon2DInt
- If a selection set is specified, filter for shapes in this set
- Map between the nodes of adjacent polygons using a radial representation
- If a spline is requested, calculate the tangents of the map-paths of the set of mapped polygons
- For each pair of mapped polygons, create a specified number of intermediate polygons whose nodes lie along the path (linear or spline) between mapped nodes.
- For unequal node counts, remove iter/deltaN nodes per iteration, based upon either segment length, node angle, or some other measure of priority (this still needs tweaking)
- Maps polygons using radial representations, as above
- Triangulates each polygon pair using the Java3D triangulator (NOTE: triangulation might be improved by making use of the mapping information)
- Author:
- Andrew Reid
- See Also:
ar.morph.sections.RadialRepresention
-
Field Summary
Fields Modifier and Type Field Description MorphDrawEngine
drawEngine
static int
MORPH_ALL
static int
MORPH_MESH
static int
MORPH_SECTIONS
AttributeList
morphAttr
-
Constructor Summary
Constructors Constructor Description MorphEngine()
-
Method Summary
Modifier and Type Method Description SectionSet3DInt
getCornerPoints(SectionSet3DInt sections)
java.util.ArrayList<MappedPolygon2DPath>
getMappedPolygons(SectionSet3DInt polySet, double weight_thres)
java.util.ArrayList<MappedPolygon2DPath>
getMappedPolygons(SectionSet3DInt polySet, double weight_thres, boolean mapMulti)
Maps the set of polygons inpolyset
between each neighbouring section.Mesh3DInt
getMorphMesh(SectionSet3DInt morphSections, double weight_thres)
Given a set of sections, map nodes using radial rep and then triangulate between sections based upon this mapping, and each polygon's direction (CW or CCW)SectionSet3DInt
getMorphSections(SectionSet3DInt sections, double weight_thres)
protected boolean[][]
getMultiPolygonMapping(java.util.ArrayList<Polygon2D> polys0, java.util.ArrayList<Polygon2D> polys1)
java.util.ArrayList<MappedPolygon2DPath>
getNodeTangents(java.util.ArrayList<MappedPolygon2DPath> paths, double spacing, double endFactor)
Given a list of mapped polygons, assign tangents to nodes based upon the mapping vectors.protected double[][]
getPolygonDistances(java.util.ArrayList<Polygon2D> polys0, java.util.ArrayList<Polygon2D> polys1)
SectionSet3DInt
getPolygonSet(SectionSet3DInt sections)
SectionSet3DInt
getSubsections(java.util.ArrayList<MappedPolygon2DPath> paths, int iters, AttributeList attr)
Given a set of mapped polygons, generatenew subsections for each section s, which morph from polygon i to polygon j. Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
morphAttr
-
drawEngine
-
MORPH_SECTIONS
public static final int MORPH_SECTIONS- See Also:
- Constant Field Values
-
MORPH_MESH
public static final int MORPH_MESH- See Also:
- Constant Field Values
-
MORPH_ALL
public static final int MORPH_ALL- See Also:
- Constant Field Values
-
-
Constructor Details
-
MorphEngine
public MorphEngine()
-
-
Method Details
-
getMorphSections
-
getCornerPoints
-
getPolygonSet
-
getMappedPolygons
public java.util.ArrayList<MappedPolygon2DPath> getMappedPolygons(SectionSet3DInt polySet, double weight_thres) -
getMappedPolygons
public java.util.ArrayList<MappedPolygon2DPath> getMappedPolygons(SectionSet3DInt polySet, double weight_thres, boolean mapMulti)Maps the set of polygons inpolyset
between each neighbouring section.- Parameters:
polySet
-weight_thres
-mapMulti
-- Returns:
-
getMultiPolygonMapping
-
getPolygonDistances
-
getNodeTangents
public java.util.ArrayList<MappedPolygon2DPath> getNodeTangents(java.util.ArrayList<MappedPolygon2DPath> paths, double spacing, double endFactor)Given a list of mapped polygons, assign tangents to nodes based upon the mapping vectors. Tangents can be used to smooth (spline) these lines and thus smooth a given morphing transition.- Parameters:
maps
- - a list of MappedPolygon2D objects- Returns:
- maps with tangent values assigned (using the "TangentX" and "TangentY" Attributes).
-
getSubsections
public SectionSet3DInt getSubsections(java.util.ArrayList<MappedPolygon2DPath> paths, int iters, AttributeList attr)Given a set of mapped polygons, generatenew subsections for each section s, which morph from polygon i to polygon j. - Parameters:
mappedPolys
- set of polygons whose nodes are mapped between sectionsiters
- number of subsections to generate- Returns:
- a MorphSections3DInt object containing generated subsections
-
getMorphMesh
Given a set of sections, map nodes using radial rep and then triangulate between sections based upon this mapping, and each polygon's direction (CW or CCW)- Parameters:
morphSections
- section set containing polygons (and only polygons) with which to generate the mesh.- Returns:
- Mesh3DInt object representing the surface connecting these section polygons
-