Class: Geom::PolygonMesh
- Inherits:
-
Object
- Object
- Geom::PolygonMesh
Overview
Triangulated mesh snapshot for export and use with ModraUp::Face#mesh, not a BRep journal. Points and polygon indices start at 1; negative indices indicate hidden edges.
Constants # collapse
- Geom::PolygonMesh::NO_SMOOTH_OR_HIDE
NO_SMOOTH_OR_HIDE = 0
The smoothing flag for ModraUp::Entities#add_faces_from_mesh / ModraUp::Entities#fill_from_mesh: no edges are hidden or smoothed.
- Geom::PolygonMesh::HIDE_BASED_ON_INDEX
HIDE_BASED_ON_INDEX = 1
ModraUp::Entities#add_faces_from_mesh / ModraUp::Entities#fill_from_mesh smooth flag: hide edges starting from negative index points.
- Geom::PolygonMesh::SOFTEN_BASED_ON_INDEX
SOFTEN_BASED_ON_INDEX = 2
The smoothing flag for ModraUp::Entities#add_faces_from_mesh / ModraUp::Entities#fill_from_mesh: Soften edges starting from negative-index points.
- Geom::PolygonMesh::AUTO_SOFTEN
AUTO_SOFTEN = 4
ModraUp::Entities#add_faces_from_mesh / ModraUp::Entities#fill_from_mesh smoothing flag: soften edges between nearly coplanar adjacent faces.
- Geom::PolygonMesh::SMOOTH_SOFT_EDGES
SMOOTH_SOFT_EDGES = 8
The smoothing flag for ModraUp::Entities#add_faces_from_mesh / ModraUp::Entities#fill_from_mesh: smooths both the edges and softens them.
Class Method Summary # collapse
-
.new ⇒ Geom::PolygonMesh
An empty mesh. Optional parameters only reserve capacity (up to approximately 1 million per item), leaving no points; points can still be added later.
Instance Method Summary # collapse
-
#add_point(point) ⇒ Integer
Add a point and return the point number starting from 1.
-
#add_polygon(i1, i2, i3, ...) ⇒ Integer
Add a polygon. Parameters are vertex indices starting from 1 (negative values indicate an implied edge), or at least three points. Returns 0 if the operation fails.
-
#count_points ⇒ Integer
Number of points.
-
#count_polygons ⇒ Integer
Number of polygons.
-
#points ⇒ Array<Geom::Point3d>
All points, in order with 1-based indexing.
-
#polygons ⇒ Array<Array<Integer>>
The vertex indices for all polygons (starting at 1; negative values indicate hidden edges).
-
#point_at(index) ⇒ Geom::Point3d, nil
The starting point. Out-of-bounds is nil.
-
#point_index(point) ⇒ Integer
The point index starts at 1; if there is no point, it is 0.
-
#polygon_at(index) ⇒ Array<Integer>, nil
The starting vertex index of the polygon. Out-of-bounds returns nil.
-
#polygon_points_at(index) ⇒ Array<Geom::Point3d>, nil
Polygon vertex coordinates. Out-of-bounds is nil.
-
#set_point(index, point) ⇒ Geom::PolygonMesh
Updates an existing point. An out-of-range index is ignored.
-
#set_uv(index, uv) ⇒ Geom::PolygonMesh
Sets the UV for the point (using Point3d x/y coordinates). The default front face is assumed.
-
#uv_at(index) ⇒ Geom::Point3d, nil
The UV of the point. Returns nil if not set.
-
#uvs ⇒ Array<Geom::Point3d>
Array of UVs for all points; is empty if not set.
-
#normal_at(index) ⇒ Geom::Vector3d, nil
The normal at the point. Returns nil if not set.
-
#transform!(transformation) ⇒ Geom::PolygonMesh
Transform all points in place.
Class Method Details
PolygonMesh.new ⇒ meshPolygonMesh.new(number_points) ⇒ meshPolygonMesh.new(number_points, number_polygons) ⇒ mesh
An empty mesh. Optional parameters only reserve capacity (up to approximately 1 million per item), leaving no points; points can still be added later.
Instance Method Details
mesh.add_point(point) ⇒ Integer
Add a point and return the point number starting from 1.
mesh.add_polygon(i1, i2, i3, ...) ⇒ Integermesh.add_polygon([i1, i2, i3]) ⇒ Integermesh.add_polygon(p1, p2, p3, ...) ⇒ Integermesh.add_polygon([p1, p2, p3]) ⇒ Integer
Add a polygon. Parameters are vertex indices starting from 1 (negative values indicate an implied edge), or at least three points. Returns 0 if the operation fails.
mesh.count_points ⇒ Integer
Number of points.
mesh.count_polygons ⇒ Integer
Number of polygons.
mesh.points ⇒ Array<Geom::Point3d>
All points, in order with 1-based indexing.
mesh.polygons ⇒ Array<Array<Integer>>
The vertex indices for all polygons (starting at 1; negative values indicate hidden edges).
mesh.point_at(index) ⇒ Geom::Point3d, nil
The starting point. Out-of-bounds is nil.
mesh.point_index(point) ⇒ Integer
The point index starts at 1; if there is no point, it is 0.
mesh.polygon_at(index) ⇒ Array<Integer>, nil
The starting vertex index of the polygon. Out-of-bounds returns nil.
mesh.polygon_points_at(index) ⇒ Array<Geom::Point3d>, nil
Polygon vertex coordinates. Out-of-bounds is nil.
mesh.set_point(index, point) ⇒ self
Updates an existing point. An out-of-range index is ignored.
mesh.set_uv(index, uv) ⇒ selfmesh.set_uv(index, uv, front) ⇒ self
Sets the UV for the point (using Point3d x/y coordinates). The default front face is assumed.
mesh.uv_at(index) ⇒ Geom::Point3d, nilmesh.uv_at(index, front) ⇒ Geom::Point3d, nil
The UV of the point. Returns nil if not set.
mesh.uvs ⇒ Array<Geom::Point3d>mesh.uvs(front) ⇒ Array<Geom::Point3d>
Array of UVs for all points; is empty if not set.
mesh.normal_at(index) ⇒ Geom::Vector3d, nil
The normal at the point. Returns nil if not set.
mesh.transform!(transformation) ⇒ self
Transform all points in place.