Class PwTexture
- java.lang.Object
-
- jv.object.PsObject
-
- jvx.project.PjWorkshop
-
- jvx.geom.PwTexture
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, PsUpdateIf, PjWorkshopIf
public class PwTexture extends PjWorkshop
Utility class for generation of surface textures.- See Also:
- Serialized Form
- Author:
- Konrad Polthier, Ulrich Reitebuch
- Version:
- 21.06.03, 2.00 revised (kp) Implementation as workshop.
19.02.02, 1.00 created (ur)
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.Stringm_defDijkstraTextureDefault texture for triangular elements.static java.lang.Stringm_defQuadTextureDefault texture for quadrilateral and higher elements.static java.lang.Stringm_defTriTextureDefault texture for triangular elements.-
Fields inherited from class jv.object.PsObject
HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
-
Fields inherited from interface jv.project.PjWorkshopIf
MODE_BUG, MODE_STANDARD, MODE_VALIDATE
-
-
Constructor Summary
Constructors Constructor and Description PwTexture()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidburn()Burns surface colors to a new texture image using element textures.static voidcompactPeriodicTextures(PdVector[][] texture)Translate texture coordinates of each element by an integer vector, such that the texture coordinates are close to 0.intgetLicSize()Get length of the longest edge of triangles in texture domain.voidinit()Resets all properties to default values.static voidmakeDijkstraTexture(PgElementSet geom)Generate element texture showing lines through all mid points of edges with different Dijkstra values at their ends.static double[]makeElementTextureCoords(PgElementSet geom, int maxwidth)Calculates element texture coordinates for triangulation.static voidmakePatchTexture(PgElementSet geom)Assign same texture image to each element of a geometry.static voidmakeThresholdTexture(PgElementSet geom, PdVector[] value, double[] threshold)Generate element texture by two sets of scalar data per vertex and two thresholds.static voidmakeThresholdTexture(PgElementSet geom, PdVector value, double threshold)Generate element texture by scalar data per vertex and a threshold value.voidsetGeometry(PgElementSet geom)Assign an element set which must be a triangulation.voidsetLicSize(int size)Set length of the longest edge of triangles in texture domain.booleanupdate(java.lang.Object event)Update the class whenever a child has changed.-
Methods inherited from class jvx.project.PjWorkshop
cancel, close, getDisplay, getDisplays, getGeometry, getMode, getSavedGeometry, getViewer, isModal, isStandalone, ok, removeGeometry, reset, setDisplay, setDisplays, setGeometry, setModal, setMode, setStandalone, setViewer
-
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jv.object.PsUpdateIf
getFather, getName, setParent
-
-
-
-
Field Detail
-
m_defQuadTexture
public static java.lang.String m_defQuadTexture
Default texture for quadrilateral and higher elements.
-
m_defTriTexture
public static java.lang.String m_defTriTexture
Default texture for triangular elements.
-
m_defDijkstraTexture
public static java.lang.String m_defDijkstraTexture
Default texture for triangular elements.
-
-
Method Detail
-
init
public void init()
Resets all properties to default values.- Overrides:
initin classPjWorkshop
-
setGeometry
public void setGeometry(PgElementSet geom)
Assign an element set which must be a triangulation.Geometry is triangulated if it is no triangulation.
- Parameters:
geom- may benullto indicate that the geometry shall be removed from this workshop.- Version:
- 21.02.04, 1.20 revised (kp) Triangulate geometry if it is no triangulation.
21.02.04, 1.10 revised (kp) Call super.setGeometry() to allow cancel of workshop.
-
update
public boolean update(java.lang.Object event)
Update the class whenever a child has changed. Method is usually invoked from the children.- Specified by:
updatein interfacePsUpdateIf- Overrides:
updatein classPjWorkshop- Parameters:
event- sender of this update.- Returns:
- true if update was correctly handled by superclass.
- See Also:
PsObject.setParent(PsUpdateIf),PsObject.getFather(),PsObject.addUpdateListener(PsUpdateIf)
-
makePatchTexture
public static void makePatchTexture(PgElementSet geom)
Assign same texture image to each element of a geometry. Currently, method requires that all elements are either triangles or quadrilaterals.Method assigns a texture to the geometry if not available. Texture image is either set to
PwTexture#m_defTriTexturefor triangulations, or toPwTexture#m_defQuadTexture.- Author:
- Konrad Polthier
- Version:
- 05.06.02, 1.00 created (kp)
-
makeDijkstraTexture
public static void makeDijkstraTexture(PgElementSet geom)
Generate element texture showing lines through all mid points of edges with different Dijkstra values at their ends.Method assigns a texture to the geometry if not available. Texture image is set to
PwTexture#m_defDijkstraTexture.- Author:
- Ulrich Reitebuch
- Version:
- 21.06.03, 1.10 revised (kp) Avoid intermediate object allocations.
19.02.02, 1.00 created (ur)
-
makeThresholdTexture
public static void makeThresholdTexture(PgElementSet geom, PdVector value, double threshold)
Generate element texture by scalar data per vertex and a threshold value. The texture coordinates will put the threshold value to the center of the texture image.Method assigns a texture to the geometry if not available. // * Texture image is set to
PwTexture#m_defDijkstraTexture.- Author:
- Ulrich Reitebuch
- Version:
- 20.09.07, 1.00 created (ur)
-
makeThresholdTexture
public static void makeThresholdTexture(PgElementSet geom, PdVector[] value, double[] threshold)
Generate element texture by two sets of scalar data per vertex and two thresholds. The first pair of threshold and scalar data will be used for the u coordinate, the second pair for the v coordinate.The texture coordinates will put the threshold values to the center of the texture image.The value and threshold arrays should have size 2. Method assigns a texture to the geometry if not available. // * Texture image is set to
PwTexture#m_defDijkstraTexture.- Author:
- Ulrich Reitebuch
- Version:
- 20.09.07, 1.00 created (ur)
-
getLicSize
public int getLicSize()
Get length of the longest edge of triangles in texture domain. Used in burn().- See Also:
burn()
-
setLicSize
public void setLicSize(int size)
Set length of the longest edge of triangles in texture domain. Used in burn().- See Also:
burn()
-
burn
public void burn()
Burns surface colors to a new texture image using element textures. Elements are laid out in the plane and the maximal edges size measured in pixels is given by setLicSize().Methods requires an assigned elementSet and a display.
HACK: Vertical gap between triangle rows is currently determined by static variable VGAP.
- See Also:
setLicSize(int),setGeometry(jv.geom.PgElementSet)
-
compactPeriodicTextures
public static void compactPeriodicTextures(PdVector[][] texture)
Translate texture coordinates of each element by an integer vector, such that the texture coordinates are close to 0. This makes sense for periodic, element based textures.- Author:
- Felix Kaelberer
- Version:
- 24.05.2013, 1.01 moved here from jvx.PgUtil (ur) 22.10.2008, 1.00 created (fk)
-
makeElementTextureCoords
public static double[] makeElementTextureCoords(PgElementSet geom, int maxwidth)
Calculates element texture coordinates for triangulation. Puts triangles in lines with longest edges at top.- Parameters:
geom- triangulationmaxwidth- length of the longest edge of triangles in texture domain- Returns:
- [(scaling factor from worldcoords to pixel)/(pixelwidth of texture)/(pixelheight of texture)]
- Version:
- 15.04.06, 2.00 revised (kp) Method moved to PwTexture from jvx.numeric.PnLIC.
21.06.03, 1.11 revised (kp) Method made public.
09.03.00, 1.10 revised (ep) Work around setElementTexCoord calls and call setElementTextures instead.
-
-
"