public class MeshFactory
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
MeshFactory.FaceType
Used by some factory methods to specify the face type
|
static class |
MeshFactory.VertexMap |
static class |
MeshFactory.VertexSet |
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_ADD_NORMALS |
Constructor and Description |
---|
MeshFactory() |
Modifier and Type | Method and Description |
---|---|
static void |
addQuadAnnularSector(PolygonalMesh mesh,
double r0,
double r1,
double ang,
int nr,
int nang,
RigidTransform3d XLM,
MeshFactory.VertexMap vtxMap)
Adds an annular sector to an existing mesh.
|
static void |
addQuadCylindricalSection(PolygonalMesh mesh,
double r,
double h,
double ang,
int nh,
int nang,
boolean outward,
RigidTransform3d XLM,
MeshFactory.VertexMap vtxMap)
Adds a cylindrical section to an existing mesh.
|
static void |
addQuadRectangle(PolygonalMesh mesh,
double wx,
double wy,
int nx,
int ny,
RigidTransform3d XLM,
MeshFactory.VertexMap vtxMap)
Adds a quad rectangle to an existing mesh.
|
static void |
addQuadSphericalSection(PolygonalMesh mesh,
double r,
double maxthe,
double maxphi,
int nthe,
int nphi,
RigidTransform3d XLM,
MeshFactory.VertexMap vtxMap)
Adds a spherical section to an existing mesh.
|
static void |
addQuadToroidalSection(PolygonalMesh mesh,
double rmajor,
double rminor,
double maxthe,
int nmajor,
int nminor,
RigidTransform3d XLM,
MeshFactory.VertexMap vtxMap)
Adds a toroidal section to an existing mesh.
|
static void |
closeSeams(PolygonalMesh mesh) |
static void |
computeTextureCoordsForSphere(PolygonalMesh mesh,
Point3d origin,
double r,
double tol) |
static PolygonalMesh |
createBox(double wx,
double wy,
double wz)
Creates a triangle-based box mesh, with two triangles per side, centered
on the origin.
|
static PolygonalMesh |
createBox(double wx,
double wy,
double wz,
boolean addNormals)
Creates a triangle-based box mesh, with two triangles per side, centered
on the origin.
|
static PolygonalMesh |
createBox(double wx,
double wy,
double wz,
double x,
double y,
double z)
Creates a triangle-based box mesh, with two triangles per side, centered
at a prescribed location.
|
static PolygonalMesh |
createBox(double wx,
double wy,
double wz,
double x,
double y,
double z,
boolean addNormals)
Creates a triangle-based box mesh, with two triangles per side, centered
at a prescribed location.
|
static PolygonalMesh |
createBox(double wx,
double wy,
double wz,
Point3d center,
int nx,
int ny,
int nz)
Creates a triangle-based box mesh, with a specified mesh resolution in
each direction, and centered at a defined center point.
|
static PolygonalMesh |
createBox(double wx,
double wy,
double wz,
Point3d center,
int nx,
int ny,
int nz,
boolean addNormals)
Creates a triangle-based box mesh, with a specified mesh resolution in
each direction, and centered at a defined center point.
|
static PolygonalMesh |
createBox(double wx,
double wy,
double wz,
Point3d center,
int nx,
int ny,
int nz,
boolean addNormals,
MeshFactory.FaceType faceType)
Creates a box mesh, with a specified mesh resolution in each direction,
and centered at a defined center point.
|
static PolygonalMesh |
createCone(double rtop,
double rbot,
double h,
int nsides) |
static PolygonalMesh |
createCylinder(double r,
double h,
int nslices)
Creates a triangular cylindrical mesh centered on the origin with
the main axis aligned with the z axis.
|
static PolygonalMesh |
createCylinder(double r,
double h,
int nslices,
int nr,
int nh)
Creates a triangular cylindrical mesh centered on the origin with
the main axis aligned with the z axis.
|
static PolygonalMesh |
createEllipsoid(double a,
double b,
double c,
int nslices)
Creates an triangular ellipsoid mesh, centered on the origin.
|
static PolygonalMesh |
createEllipsoid(double a,
double b,
double c,
int nslices,
int nlevels)
Creates an triangular ellipsoid mesh, centered on the origin.
|
static PolygonalMesh |
createExtendedTorus(double rmajor,
double rminor,
double xlen,
int nmajor,
int nminor)
Creates a quad extended torus mesh in the x-y plane.
|
static PolygonalMesh |
createFromFaces(java.lang.Iterable<Face> faces)
Create a new PolygonalMesh from a subset of faces.
|
static PolygonalMesh |
createHemisphere(double r,
int nslices,
int nlevels)
Creates an open triangular hemispherical mesh, centered on the origin,
with a radius
r . |
static PolygonalMesh |
createHollowedBox(double wx,
double wy,
double wz,
double r,
int nsegs)
Creates a box with a cylindrical indentation in the top, parallel to the y
axis, with a radius of r and approximated by nsegs segments.
|
static PolygonalMesh |
createIcosahedralSphere(double r,
int divisions) |
static PolygonalMesh |
createIcosahedralSphere(double r,
Point3d c,
int divisions) |
static PolygonalMesh |
createIcosahedron(double r) |
static PolygonalMesh |
createOctahedralSphere(double r,
int divisions) |
static PolygonalMesh |
createOctahedralSphere(double r,
Point3d c,
int divisions) |
static PolygonalMesh |
createOctahedron(double r) |
static PolygonalMesh |
createOpenCylinder(double r,
double h,
int nslices,
int nh)
Creates an open cylindrical mesh centered on the origin with the
main axis aligned with the z axis.
|
static PolygonalMesh |
createOpenQuadCylinder(double r,
double h,
int nslices,
int nh)
Creates an open quad cylindrical mesh centered on the origin with the
main axis aligned with the z axis.
|
static PolygonalMesh |
createPlane(double wx,
double wy)
Legacy method to create a rectangle with texture coordinates;
calls
createRectangle(wx,wy,true) . |
static PolygonalMesh |
createPlane(double wx,
double wy,
int xdiv,
int ydiv)
Legacy method to create a rectangle with texture coordinates;
calls
createRectangle(wx,wy,xdiv,ydiv,true) . |
static PolygonalMesh |
createPointedCylinder(double r,
double h,
double tiph,
int nsides) |
static PolygonalMesh |
createPrism(double[] xy,
double h) |
static PolygonalMesh |
createPrism(double[] xyTop,
double[] xyBot,
double h) |
static PolygonalMesh |
createQuadAnnularSector(double r0,
double r1,
double ang,
int nr,
int nang)
Creates an annular sector.
|
static PolygonalMesh |
createQuadBox(double wx,
double wy,
double wz)
Creates a quad-based box mesh, with one quad per side, centered on the
origin.
|
static PolygonalMesh |
createQuadBox(double wx,
double wy,
double wz,
boolean addNormals)
Creates a quad-based box mesh, with one quad per side, centered on the
origin.
|
static PolygonalMesh |
createQuadBox(double wx,
double wy,
double wz,
double x,
double y,
double z)
Creates a quad-based box mesh, with one quad per side, centered at
a prescribed location.
|
static PolygonalMesh |
createQuadBox(double wx,
double wy,
double wz,
double x,
double y,
double z,
boolean addNormals)
Creates a quad-based box mesh, with one quad per side, centered at
a prescribed location.
|
static PolygonalMesh |
createQuadBox(double wx,
double wy,
double wz,
Point3d center,
int nx,
int ny,
int nz)
Creates a quad-based box mesh, with a specified mesh resolution in
each direction, and centered at a defined center point.
|
static PolygonalMesh |
createQuadBoxNew(double wx,
double wy,
double wz,
Point3d center,
int nx,
int ny,
int nz) |
static PolygonalMesh |
createQuadCone(double rtop,
double rbot,
double h,
int nsides) |
static PolygonalMesh |
createQuadCone(double rtop,
double rbot,
double h,
int nsides,
int nh) |
static PolygonalMesh |
createQuadCylinder(double r,
double h,
int nslices,
int nr,
int nh)
Creates a quad cylindrical mesh centered on the origin with the main axis
aligned with the z axis.
|
static PolygonalMesh |
createQuadCylindricalSection(double r,
double h,
double ang,
int nh,
int nang)
Creates a cylindrical section.
|
static PolygonalMesh |
createQuadExtendedTorus(double rmajor,
double rminor,
double xlen,
int nmajor,
int nminor)
Creates a quad extended torus mesh in the x-y plane.
|
static PolygonalMesh |
createQuadHemisphere(double r,
int nslices,
int nlevels,
double x,
double y,
double z) |
static PolygonalMesh |
createQuadPrism(double[] xy,
double h) |
static PolygonalMesh |
createQuadPrism(double[] xyTop,
double[] xyBot,
double h) |
static PolygonalMesh |
createQuadPrism(double[] xyTop,
double[] xyBot,
double h,
int nH) |
static PolygonalMesh |
createQuadRectangle(double wx,
double wy,
int nx,
int ny)
Create a quad rectangle mesh.
|
static PolygonalMesh |
createQuadRoundedBox(double wx,
double wy,
double wz,
int nslices)
Creates a box with rounded ends on the x-axis ends.
|
static PolygonalMesh |
createQuadRoundedBox(double wx,
double wy,
double wz,
int nx,
int ny,
int nz,
int nslices)
Creates a box with rounded ends on the x-axis ends, and with a specified
mesh resolution in the x, y, and z directions.
|
static PolygonalMesh |
createQuadRoundedCylinder(double r,
double h,
int nslices,
int nsegs,
boolean flatBottom)
Creates a cylinder with rounded (spherical) ends on the z-axis ends.
|
static PolygonalMesh |
createQuadSphere(double r,
int nslices) |
static PolygonalMesh |
createQuadSphere(double r,
int nslices,
double x,
double y,
double z) |
static PolygonalMesh |
createQuadSphere(double r,
int nslices,
int nlevels,
double x,
double y,
double z,
boolean addTextureCoords) |
static PolygonalMesh |
createQuadSphericalSection(double r,
double maxthe,
double maxphi,
int nthe,
int nphi)
Creates a spherical section.
|
static PolygonalMesh |
createQuadToroidalSection(double rmajor,
double rminor,
double maxthe,
int nmajor,
int nminor)
Creates a toroidal section.
|
static PolygonalMesh |
createQuadTorus(double rmajor,
double rminor,
int nmajor,
int nminor)
Creates a quad torus mesh in the x-y plane.
|
static PolygonalMesh |
createQuadTube(double r0,
double r1,
double h,
int nslices,
int nr,
int nh)
Creates a quad tube mesh centered on the origin with the main axis
aligned with the z axis.
|
static PointMesh |
createRandomPointMesh(int numv,
double width)
Creates a random point mesh, centered on the orgin, with a
specified number of vertices and width.
|
static PolygonalMesh |
createRectangle(double wx,
double wy,
boolean addTextureCoords)
Create a open rectanglar mesh, composed of two triangles, in the x-y
plane, centered on the origin and with normals directed along the z axis.
|
static PolygonalMesh |
createRectangle(double wx,
double wy,
int xdiv,
int ydiv,
boolean addTextureCoords)
Create a open rectangular mesh, composed of triangles, in the x-y
plane, centered on the origin and with normals directed along the z axis.
|
static PolygonalMesh |
createRectangle(double wx,
double wy,
int xdiv,
int ydiv,
boolean addNormals,
boolean addTextureCoords)
Create a open rectangular mesh, composed of triangles, in the x-y
plane, centered on the origin and with normals directed along the z axis.
|
static PolygonalMesh |
createRefinedMesh(PolygonalMesh orig,
int res)
Creates a refined version of a polygonal mesh, based on Nagata patches
applied with a given resolution.
|
static PolygonalMesh |
createRoundedBox(double wx,
double wy,
double wz,
int nslices)
Creates a triangular box mesh with rounded ends on the z-axis ends.
|
static PolygonalMesh |
createRoundedBox(double wx,
double wy,
double wz,
int nx,
int ny,
int nz,
int nslices)
Creates a triangule box mesh with rounded ends on the x-axis ends, and
with a specified mesh resolution in the x, y, and z directions.
|
static PolygonalMesh |
createRoundedCylinder(double r,
double h,
int nslices,
int nsegs,
boolean flatBottom)
Creates a triangular cylinder mesh with rounded (spherical) ends on the
z-axis ends.
|
static PolygonalMesh |
createSkylineMesh(double wx,
double wy,
double wz,
int nx,
int ny,
java.lang.String... depthField)
Creates a "skyline" mesh, which is a mesh defined over a rectangular
region in the x-y plane.
|
static PolygonalMesh |
createSphere(double r,
int nslices)
Creates a spherical triangular mesh, centered on the origin,
with a radius
r . |
static PolygonalMesh |
createSphere(double r,
int nslices,
double x,
double y,
double z) |
static PolygonalMesh |
createSphere(double r,
int nslices,
int nlevels)
Creates a spherical triangular mesh, centered on the origin,
with a radius
r . |
static PolygonalMesh |
createSphere(double r,
int nslices,
int nlevels,
boolean addTextureCoords)
Creates a spherical triangular mesh, centered on the origin,
with a radius
r . |
static PolylineMesh |
createSphericalPolyline(double r,
int nslices,
int nlevels) |
static PolygonalMesh |
createTorus(double rmajor,
double rminor,
int nmajor,
int nminor)
Creates a triangular torus mesh in the x-y plane.
|
static PolygonalMesh |
createTube(double r0,
double r1,
double h,
int nslices,
int nr,
int nh)
Creates a triangular tube mesh centered on the origin with the main axis
aligned with the z axis.
|
static boolean |
fillHoles(PolygonalMesh mesh) |
static java.util.ArrayList<HalfEdge> |
findBorderEdges(PolygonalMesh mesh) |
static PolygonalMesh |
getFlipped(PolygonalMesh mesh) |
static PolygonalMesh |
getIntersection(PolygonalMesh mesh1,
PolygonalMesh mesh2) |
static PolygonalMesh |
getSubtraction(PolygonalMesh mesh1,
PolygonalMesh mesh2) |
static PolygonalMesh |
getUnion(PolygonalMesh mesh1,
PolygonalMesh mesh2) |
static void |
main(java.lang.String[] args) |
static void |
mergeVertices(PolygonalMesh mesh,
Vertex3d vtx1,
Vertex3d vtx2) |
static void |
projectToSphere(double r,
Point3d c,
PolygonalMesh mesh) |
static void |
relax(PolygonalMesh mesh) |
static PolygonalMesh |
subdivide(PolygonalMesh orig) |
static PolygonalMesh |
subdivide(PolygonalMesh orig,
int numIters) |
static void |
triangulateFaceCentroid(Face face) |
static void |
triangulateFaceCentroid(PolygonalMesh mesh) |
public static void addQuadRectangle(PolygonalMesh mesh, double wx, double wy, int nx, int ny, RigidTransform3d XLM, MeshFactory.VertexMap vtxMap)
mesh
- existing mesh to add the rectangle towx
- width of the rectangle along the local x axiswy
- width of the rectangle along the local y axisnx
- number of subdivisions along the local x axisny
- number of subdivisions along the local y axisXLM
- transform from the local coordinate frame L to mesh
coordinates M.vtxMap
- spatial hash map storing all existing vertices in the
mesh. New vertices will be created as needed and added to both this
map and to the mesh.public static PolygonalMesh createQuadRectangle(double wx, double wy, int nx, int ny)
wx
- width of the rectangle along the local x axiswy
- width of the rectangle along the local y axisnx
- number of subdivisions along the local x axisny
- number of subdivisions along the local y axispublic static void addQuadAnnularSector(PolygonalMesh mesh, double r0, double r1, double ang, int nr, int nang, RigidTransform3d XLM, MeshFactory.VertexMap vtxMap)
ang/2
on either side of the x axis, and from an inner
radius r0
to an outer radius r1
; if
ang
is 2 PI and r0
is 0 then the sector becomes
a circle with radius r1
. The mesh is made of quads
except for those faces connected to the origin. A transform XLM is
supplied to map L into the mesh coordinate frame M.mesh
- existing mesh to add the annular sector tor0
- inner radius of the sectorr1
- outer radius of the sectorang
- total angular extent of the sectornr
- number of radial slicesnang
- number of angular slicesXLM
- transform from the local coordinate frame L to mesh
coordinates M.vtxMap
- spatial hash map storing all existing vertices in the
mesh. New vertices will be created as needed and added to both this
map and to the mesh.public static PolygonalMesh createQuadAnnularSector(double r0, double r1, double ang, int nr, int nang)
addQuadAnnularSector(maspack.geometry.PolygonalMesh, double, double, double, int, int, maspack.matrix.RigidTransform3d, maspack.geometry.MeshFactory.VertexMap)
.r0
- inner radius of the annular sectorr1
- outer radius of the annular sectorang
- total angular extent of the annular sectornr
- number of radial slicesnang
- number of angular slicespublic static void addQuadCylindricalSection(PolygonalMesh mesh, double r, double h, double ang, int nh, int nang, boolean outward, RigidTransform3d XLM, MeshFactory.VertexMap vtxMap)
h/2
above and below the origin. The angular extent of the
section is +/-ang/2
on either side of the x axis; if
ang
is 2 PI then the section will become a whole cylinder.
Normals are oriented to face outwards. The sector is made of quads. A
transform XLM is supplied to map L into the mesh coordinate frame M.mesh
- existing mesh to add the section tor
- radius of the cylinderh
- height of the cylinderang
- total angular extent of the sectionnh
- number of height slicesnang
- number of angular slicesoutward
- if true
, the normals are facing outwardXLM
- transform from the local coordinate frame L to mesh
coordinates M.vtxMap
- spatial hash map storing all existing vertices in the
mesh. New vertices will be created as needed and added to both this
map and to the mesh.public static PolygonalMesh createQuadCylindricalSection(double r, double h, double ang, int nh, int nang)
h/2
above and below the origin. The angular extent of the section is
+/-ang/2
on either side of the x axis; if ang
is 2 PI then the section will become a whole cylinder. Normals are
oriented to face outwards. The sector is made of quads.r
- radius of the cylinderh
- height of the cylinderang
- total angular extent of the sectionnh
- number of height slicesnang
- number of angular slicespublic static void addQuadSphericalSection(PolygonalMesh mesh, double r, double maxthe, double maxphi, int nthe, int nphi, RigidTransform3d XLM, MeshFactory.VertexMap vtxMap)
r sin(phi) cos(theta), r sin(phi) sin(theta), r cos(phi)The extent of phi is given by [0, maxphi], while the extend of theta is given by [-maxthe, maxthe]. Specifying maxphi and maxthe as both PI results in a complete sphere. Normals are oriented to face outwards. The section is made of quads, except at the poles. A transform XLM is supplied to map L into the mesh coordinate frame M.
Note: to avoid degenarte quads near the south pole of the section,
maxphi
is rounded to PI if it is within 1e-4 of PI.
mesh
- existing mesh to add the section tor
- radius of the sectionmaxthe
- maximum azimuth angle about either side of the x axismaxphi
- maximum elevation angle with respect to the z axisnthe
- number of slices for the azimuthnphi
- number of slices for the elevationXLM
- transform from the local coordinate frame L to mesh
coordinates M.vtxMap
- spatial hash map storing all existing vertices in the
mesh. New vertices will be created as needed and added to both this
map and to the mesh.public static PolygonalMesh createQuadSphericalSection(double r, double maxthe, double maxphi, int nthe, int nphi)
addQuadSphericalSection(maspack.geometry.PolygonalMesh, double, double, double, int, int, maspack.matrix.RigidTransform3d, maspack.geometry.MeshFactory.VertexMap)
.r
- radius of the sectionmaxthe
- maximum azimuth angle about either side of the x axismaxphi
- maximum elevation angle with respect to the z axisnthe
- number of slices for the azimuthnphi
- number of slices for the elevationpublic static void addQuadToroidalSection(PolygonalMesh mesh, double rmajor, double rminor, double maxthe, int nmajor, int nminor, RigidTransform3d XLM, MeshFactory.VertexMap vtxMap)
maxthe
, with the starting end aligned with the x-z plane.
The major radius from the z axis to the center of the tube is given by
rmajor
, and the minor radius of the tube section itself is
given by rminor
.
The section made out of quads. It is closed into a torus if
maxthe
is equal to 2*Math.PI
.
mesh
- existing mesh to add the section tormajor
- major radius of bending about the z axisrminor
- minor radius of the tubemaxthe
- maximum bending angle about the z axisnmajor
- number of slices along the major radiusnminor
- number of slices along the minor radiusXLM
- transform from the local coordinate frame L to mesh
coordinates M.vtxMap
- spatial hash map storing all existing vertices in the
mesh. New vertices will be created as needed and added to both this
map and to the mesh.public static PolygonalMesh createQuadToroidalSection(double rmajor, double rminor, double maxthe, int nmajor, int nminor)
maxthe
,
with the starting end aligned with the x-z plane. For additional
information, see the documentation for addQuadToroidalSection(maspack.geometry.PolygonalMesh, double, double, double, int, int, maspack.matrix.RigidTransform3d, maspack.geometry.MeshFactory.VertexMap)
.rmajor
- major radius of bending about the z axisrminor
- minor radius of the tubemaxthe
- maximum bending angle about the z axisnmajor
- number of slices along the major radiusnminor
- number of slices along the minor radiuspublic static PolygonalMesh createQuadTorus(double rmajor, double rminor, int nmajor, int nminor)
rmajor
- major radius of the torusrminor
- minor radius of the torusnmajor
- number of slices along the major radiusnminor
- number of slices along the minor radiuspublic static PolygonalMesh createTorus(double rmajor, double rminor, int nmajor, int nminor)
rmajor
- major radius of the torusrminor
- minor radius of the torusnmajor
- number of slices along the major radiusnminor
- number of slices along the minor radiuspublic static PolygonalMesh createQuadExtendedTorus(double rmajor, double rminor, double xlen, int nmajor, int nminor)
rmajor
- major radius of the torusrminor
- minor radius of the torusxlen
- length of the straight sectionsnmajor
- number of slices along the major radiusnminor
- number of slices along the minor radiuspublic static PolygonalMesh createExtendedTorus(double rmajor, double rminor, double xlen, int nmajor, int nminor)
rmajor
- major radius of the torusrminor
- minor radius of the torusxlen
- length of the straight sectionsnmajor
- number of slices along the major radiusnminor
- number of slices along the minor radiuspublic static PolygonalMesh createPlane(double wx, double wy)
createRectangle(wx,wy,true)
.wx
- width in the x directionwy
- width in the y directionpublic static PolygonalMesh createRectangle(double wx, double wy, boolean addTextureCoords)
wx
- width in the x directionwy
- width in the y directionaddTextureCoords
- if true
, generates texture
coordinatespublic static PolygonalMesh createPlane(double wx, double wy, int xdiv, int ydiv)
createRectangle(wx,wy,xdiv,ydiv,true)
.wx
- width in the x directionwy
- width in the y directionxdiv
- number of divisions in x (>=1)ydiv
- number of divisions in y (>=1)public static PolygonalMesh createRectangle(double wx, double wy, int xdiv, int ydiv, boolean addTextureCoords)
wx
- width in the x directionwy
- width in the y directionxdiv
- number of divisions in x (>=1)ydiv
- number of divisions in y (>=1)addTextureCoords
- if true
, generates texture
coordinatespublic static PolygonalMesh createRectangle(double wx, double wy, int xdiv, int ydiv, boolean addNormals, boolean addTextureCoords)
wx
- width in the x directionwy
- width in the y directionxdiv
- number of divisions in x (>=1)ydiv
- number of divisions in y (>=1)addNormals
- if true
, generates normals in
the positive z directionaddTextureCoords
- if true
, generates texture
coordinatespublic static PolygonalMesh createQuadBox(double wx, double wy, double wz)
wx
- width in the x directionwy
- width in the y directionwz
- width in the z directionpublic static PolygonalMesh createQuadBox(double wx, double wy, double wz, boolean addNormals)
wx
- width in the x directionwy
- width in the y directionwz
- width in the z directionaddNormals
- if true
, generates normals perpendicular
to each sidepublic static PolygonalMesh createQuadBox(double wx, double wy, double wz, double x, double y, double z)
wx
- width in the x directionwy
- width in the y directionwz
- width in the z directionx
- center location along the x axisy
- center location along the y axisz
- center location along the z axispublic static PolygonalMesh createQuadBox(double wx, double wy, double wz, double x, double y, double z, boolean addNormals)
wx
- width in the x directionwy
- width in the y directionwz
- width in the z directionx
- center location along the x axisy
- center location along the y axisz
- center location along the z axisaddNormals
- if true
, generates normals perpendicular
to each sidepublic static PolygonalMesh createBox(double wx, double wy, double wz)
wx
- width in the x directionwy
- width in the y directionwz
- width in the z directionpublic static PolygonalMesh createBox(double wx, double wy, double wz, boolean addNormals)
wx
- width in the x directionwy
- width in the y directionwz
- width in the z directionaddNormals
- if true
, generates normals perpendicular
to each sidepublic static PolygonalMesh createBox(double wx, double wy, double wz, double x, double y, double z)
wx
- width in the x directionwy
- width in the y directionwz
- width in the z directionx
- center location along the x axisy
- center location along the y axisz
- center location along the z axispublic static PolygonalMesh createBox(double wx, double wy, double wz, double x, double y, double z, boolean addNormals)
wx
- width in the x directionwy
- width in the y directionwz
- width in the z directionx
- center location along the x axisy
- center location along the y axisz
- center location along the z axisaddNormals
- if true
, generates normals perpendicular
to each sidepublic static PolygonalMesh createBox(double wx, double wy, double wz, Point3d center, int nx, int ny, int nz)
wx
- width in the x directionwy
- width in the y directionwz
- width in the z directioncenter
- center of the boxnx
- number of subdivisions along xny
- number of subdivisions along ynz
- number of subdivisions along zpublic static PolygonalMesh createBox(double wx, double wy, double wz, Point3d center, int nx, int ny, int nz, boolean addNormals)
wx
- width in the x directionwy
- width in the y directionwz
- width in the z directioncenter
- center of the boxnx
- number of subdivisions along xny
- number of subdivisions along ynz
- number of subdivisions along zaddNormals
- if true
, generates normals perpendicular
to each sidepublic static PolygonalMesh subdivide(PolygonalMesh orig, int numIters)
public static PolygonalMesh subdivide(PolygonalMesh orig)
public static PolygonalMesh createQuadBox(double wx, double wy, double wz, Point3d center, int nx, int ny, int nz)
wx
- width in the x directionwy
- width in the y directionwz
- width in the z directioncenter
- center of the boxnx
- number of subdivisions along xny
- number of subdivisions along ynz
- number of subdivisions along zpublic static PolygonalMesh createBox(double wx, double wy, double wz, Point3d center, int nx, int ny, int nz, boolean addNormals, MeshFactory.FaceType faceType)
faceType
wx
- width in the x directionwy
- width in the y directionwz
- width in the z directioncenter
- center of the boxnx
- number of subdivisions along xny
- number of subdivisions along ynz
- number of subdivisions along zaddNormals
- if true
, generates normals perpendicular
to each sidefaceType
- specifies the face type to be either quads, triangles,
or triangles with alternating diagonalspublic static PolygonalMesh createQuadBoxNew(double wx, double wy, double wz, Point3d center, int nx, int ny, int nz)
public static void triangulateFaceCentroid(PolygonalMesh mesh)
public static PolygonalMesh createCylinder(double r, double h, int nslices)
r
- outer radius of the cylinderh
- height of the cylindernslices
- number of segments about the z axispublic static PolygonalMesh createCylinder(double r, double h, int nslices, int nr, int nh)
r
- outer radius of the cylinderh
- height of the cylindernslices
- number of segments about the z axisnr
- number of radial segments on each end capnh
- number of height segments along the z axispublic static void triangulateFaceCentroid(Face face)
public static PolygonalMesh createOpenCylinder(double r, double h, int nslices, int nh)
r
- outer radius of the cylinderh
- height of the cylindernslices
- number of segments about the z axisnh
- number of height segments along the z axispublic static PolygonalMesh createOpenQuadCylinder(double r, double h, int nslices, int nh)
r
- outer radius of the cylinderh
- height of the cylindernslices
- number of segments about the z axisnh
- number of height segments along the z axispublic static PolygonalMesh createQuadCylinder(double r, double h, int nslices, int nr, int nh)
r
- outer radius of the cylinderh
- height of the cylindernslices
- number of segments about the z axisnr
- number of radial segments on each end capnh
- number of height segments along the z axispublic static PolygonalMesh createQuadTube(double r0, double r1, double h, int nslices, int nr, int nh)
r0
- inner radius of the tuber1
- outer radius of the tubeh
- height of the tubenslices
- number of segments about the z axisnr
- number of radial segments on each endnh
- number of height segments along the z axispublic static PolygonalMesh createTube(double r0, double r1, double h, int nslices, int nr, int nh)
r0
- inner radius of the tuber1
- outer radius of the tubeh
- height of the tubenslices
- number of segments about the z axisnr
- number of radial segments on each endnh
- number of height segments along the z axispublic static PolygonalMesh createPointedCylinder(double r, double h, double tiph, int nsides)
public static void relax(PolygonalMesh mesh)
public static void projectToSphere(double r, Point3d c, PolygonalMesh mesh)
public static PolygonalMesh createOctahedralSphere(double r, int divisions)
public static PolygonalMesh createOctahedralSphere(double r, Point3d c, int divisions)
public static PolygonalMesh createIcosahedralSphere(double r, int divisions)
public static PolygonalMesh createIcosahedralSphere(double r, Point3d c, int divisions)
public static PolygonalMesh createOctahedron(double r)
public static PolygonalMesh createIcosahedron(double r)
public static PolygonalMesh createQuadSphere(double r, int nslices)
public static PolygonalMesh createSphere(double r, int nslices)
r
. The mesh is constructed using spherical
coordinates, with a resolution of nslices
about the
equator and nslices/2
longitudinally.r
- radius of the spherenslices
- mesh resolutionpublic static PolygonalMesh createSphere(double r, int nslices, int nlevels)
r
. The mesh is constructed using spherical
coordinates, with a resolution of nslices
about the
equator and nlevels
longitudinally.r
- radius of the spherenslices
- equatorial mesh resolutionnlevels
- longitudinal mesh resolutionpublic static PolygonalMesh createSphere(double r, int nslices, int nlevels, boolean addTextureCoords)
r
. The mesh is constructed using spherical
coordinates, with a resolution of nslices
about the
equator and nlevels
longitudinally. Texture coordinates
can optionally be created, where (0,0) and (1,1) map
to the spherical coordinates (-PI,PI) (south pole) and (PI,0)
(north pole).r
- radius of the spherenslices
- equatorial mesh resolutionnlevels
- longitudinal mesh resolutionaddTextureCoords
- if true
, generates texture
coordinatespublic static PolygonalMesh createEllipsoid(double a, double b, double c, int nslices)
nslices
about the equator and nslices/2
longitudinally.a
- semi-axis length along xb
- semi-axis length along yc
- semi-axis length along znslices
- mesh resolutionpublic static PolygonalMesh createEllipsoid(double a, double b, double c, int nslices, int nlevels)
nslices
about the equator and nlevels
longitudinally.a
- semi-axis length along xb
- semi-axis length along yc
- semi-axis length along znslices
- equatorial mesh resolutionnlevels
- longitudinal mesh resolutionpublic static PolygonalMesh createHemisphere(double r, int nslices, int nlevels)
r
. The mesh is constructed using spherical
coordinates, with a resolution of nslices
about the equator
and nlevels
longitudinally.r
- radius of the spherenslices
- equatorial mesh resolutionnlevels
- longitudinal mesh resolutionpublic static PolygonalMesh createQuadSphere(double r, int nslices, double x, double y, double z)
public static void computeTextureCoordsForSphere(PolygonalMesh mesh, Point3d origin, double r, double tol)
public static PolygonalMesh createQuadSphere(double r, int nslices, int nlevels, double x, double y, double z, boolean addTextureCoords)
public static PolygonalMesh createQuadHemisphere(double r, int nslices, int nlevels, double x, double y, double z)
public static PolygonalMesh createSphere(double r, int nslices, double x, double y, double z)
public static PolygonalMesh createQuadRoundedBox(double wx, double wy, double wz, int nslices)
wx
- width along the x axiswy
- width along the y axiswz
- width along the z axisnslices
- gives the number of sides used to approximate each
semi-circlar endpublic static PolygonalMesh createQuadRoundedBox(double wx, double wy, double wz, int nx, int ny, int nz, int nslices)
wx
- width along the x axiswy
- width along the y axiswz
- width along the z axisnx
- number of mesh divisions along x between the rounding centersny
- number of mesh divisions along y between the rounding centersnz
- number of mesh divisions along z between the rounding centersnslices
- gives the number of sides used to approximate each
semi-circlar endpublic static PolygonalMesh createRoundedBox(double wx, double wy, double wz, int nx, int ny, int nz, int nslices)
wx
- width along the x axiswy
- width along the y axiswz
- width along the z axisnx
- number of mesh divisions along x between the rounding centersny
- number of mesh divisions along y between the rounding centersnz
- number of mesh divisions along z between the rounding centersnslices
- gives the number of sides used to approximate each
semi-circlar endpublic static PolygonalMesh createRoundedBox(double wx, double wy, double wz, int nslices)
wx
- width along the x axiswy
- width along the y axiswz
- width along the z axisnslices
- gives the number of sides used to approximate each
semi-circlar endpublic static PolygonalMesh createQuadRoundedCylinder(double r, double h, int nslices, int nsegs, boolean flatBottom)
flatBottom
can be used to request that
the bottom of cylinder is flat instead of rounded.r
- radius of the cylinderh
- height of the cylinder along the z axis (measured as the distance between
the centers of the rounded ends.nslices
- number of sides used to form the cylinder. This will be rounded up to a
multiple of 4.nsegs
- number of segments along the length of the cylinder. This must be greater
than 0.flatBottom
- if true
, indicates that the bottom
of the cylinder should be flat instead of rounded.public static PolygonalMesh createRoundedCylinder(double r, double h, int nslices, int nsegs, boolean flatBottom)
flatBottom
can be used to request that the bottom of
cylinder is flat instead of rounded.r
- radius of the cylinderh
- height of the cylinder along the z axis (measured as the distance between
the centers of the rounded ends.nslices
- number of sides used to form the cylinder. This will be rounded up to a
multiple of 4.nsegs
- number of segments along the length of the cylinder. This must be greater
than 0.flatBottom
- if true
, indicates that the bottom
of the cylinder should be flat instead of rounded.public static PolygonalMesh createQuadCone(double rtop, double rbot, double h, int nsides, int nh)
public static PolygonalMesh createQuadCone(double rtop, double rbot, double h, int nsides)
public static PolygonalMesh createCone(double rtop, double rbot, double h, int nsides)
public static PolygonalMesh createQuadPrism(double[] xy, double h)
public static PolygonalMesh createPrism(double[] xy, double h)
public static PolygonalMesh createQuadPrism(double[] xyTop, double[] xyBot, double h)
public static PolygonalMesh createQuadPrism(double[] xyTop, double[] xyBot, double h, int nH)
public static PolygonalMesh createPrism(double[] xyTop, double[] xyBot, double h)
public static PolygonalMesh createHollowedBox(double wx, double wy, double wz, double r, int nsegs)
public static PolylineMesh createSphericalPolyline(double r, int nslices, int nlevels)
public static PolygonalMesh createSkylineMesh(double wx, double wy, double wz, int nx, int ny, java.lang.String... depthField)
The mesh is centered on the origin, with the bottom face set at z = -wz and a depth of 0 corresponding to z = 0. If the number of strings is less then ny, or the number of characters in any given string is less then nx, the missing digits are assumed to be '0'. Extra strings or characters are ignored.
wx
- width of the mesh along the x axiswy
- height of the mesh along the y axis.wz
- basic unit of depthnx
- number of grid cells in the x directionny
- number of grid cells in the y directiondepthField
- character strings giving the depth of each grid cellpublic static PointMesh createRandomPointMesh(int numv, double width)
public static PolygonalMesh createRefinedMesh(PolygonalMesh orig, int res)
public static PolygonalMesh getIntersection(PolygonalMesh mesh1, PolygonalMesh mesh2)
public static PolygonalMesh getUnion(PolygonalMesh mesh1, PolygonalMesh mesh2)
public static PolygonalMesh getSubtraction(PolygonalMesh mesh1, PolygonalMesh mesh2)
public static void main(java.lang.String[] args)
public static java.util.ArrayList<HalfEdge> findBorderEdges(PolygonalMesh mesh)
public static boolean fillHoles(PolygonalMesh mesh)
public static void closeSeams(PolygonalMesh mesh)
public static void mergeVertices(PolygonalMesh mesh, Vertex3d vtx1, Vertex3d vtx2)
public static PolygonalMesh getFlipped(PolygonalMesh mesh)
public static PolygonalMesh createFromFaces(java.lang.Iterable<Face> faces)
faces
- set of faces