Module: Geom
Overview
Geometry classes include Geom::Point3d, Geom::Point2d, Geom::Vector3d, Geom::BoundingBox, Geom::Bounds2d, Geom::Transformation, and Geom::PolygonMesh. The module also exposes line and plane tests, Geom::ORIGIN, Geom::X_AXIS, Geom::Y_AXIS, Geom::Z_AXIS, and Geom::IDENTITY. Represent a line as [point, vector] or [point, point]. Represent a plane as [point, normal] or four coefficients [A, B, C, D] for the equation Ax + By + Cz + D = 0.
Defined Under Namespace
Classes: BoundingBox, Bounds2d, Point2d, Point3d, PolygonMesh, Transformation, Vector3d
Constants # collapse
- Geom::ORIGIN
ORIGIN = Geom::Point3d.new(0, 0, 0)
The model origin.
- Geom::X_AXIS
X_AXIS = Geom::Vector3d.new(1, 0, 0)
The World X-axis.
- Geom::Y_AXIS
Y_AXIS = Geom::Vector3d.new(0, 1, 0)
World Y-axis.
- Geom::Z_AXIS
Z_AXIS = Geom::Vector3d.new(0, 0, 1)
The World Z-axis.
- Geom::IDENTITY
IDENTITY = Geom::Transformation.new
Unit transformation.
Class Method Summary # collapse
-
.closest_points(line1, line2) ⇒ Array<Geom::Point3d>
The closest pair of points on two infinite lines. The first point is on line1.
-
.fit_plane_to_points(point1, point2, point3, ...) ⇒ Array<Float>
Fit a plane to a set of points and return the coefficients for the equation Ax + By + Cz + D = 0. Allow for some points to not lie on the plane when more than three points are provided.
-
.intersect_line_line(line1, line2) ⇒ Geom::Point3d, nil
Intersection point of two infinite lines; returns nil if they are parallel and do not intersect.
-
.intersect_line_plane(line, plane) ⇒ Geom::Point3d, nil
The intersection point of an infinite line and a plane; returns nil if they are parallel.
-
.intersect_plane_plane(plane1, plane2) ⇒ Array, nil
Intersection of two planes [point, direction]; parallel planes return nil.
-
.linear_combination(weight1, point1, weight2, point2) ⇒ Geom::Point3d, Geom::Vector3d
Linear combination of two points or two vectors: weight1 * a weight2 * b+.
-
.point_in_polygon_2D(point, polygon, check_border) ⇒ Boolean
Does the point lie inside the polygon. Ignore the Z coordinate of the point with respect to the polygon vertices.
-
.tesselate(outer, *holes) ⇒ Array<Geom::Point3d>
Triangulates a planar polygon and returns a flat list of points, three per triangle. Supply the outer loop counterclockwise and hole loops clockwise.
Class Method Details
Geom.closest_points(line1, line2) ⇒ Array(Geom::Point3d, Geom::Point3d)
The closest pair of points on two infinite lines. The first point is on line1.
Geom.fit_plane_to_points(point1, point2, point3, ...) ⇒ Array(Float, Float, Float, Float)Geom.fit_plane_to_points(points) ⇒ Array(Float, Float, Float, Float)
Fit a plane to a set of points and return the coefficients for the equation Ax + By + Cz + D = 0. Allow for some points to not lie on the plane when more than three points are provided.
Geom.intersect_line_line(line1, line2) ⇒ Geom::Point3d, nil
Intersection point of two infinite lines; returns nil if they are parallel and do not intersect.
Geom.intersect_line_plane(line, plane) ⇒ Geom::Point3d, nil
The intersection point of an infinite line and a plane; returns nil if they are parallel.
Geom.intersect_plane_plane(plane1, plane2) ⇒ Array(Geom::Point3d, Geom::Vector3d), nil
Intersection of two planes [point, direction]; parallel planes return nil.
Geom.linear_combination(weight1, point1, weight2, point2) ⇒ Geom::Point3dGeom.linear_combination(weight1, vector1, weight2, vector2) ⇒ Geom::Vector3d
Linear combination of two points or two vectors: weight1 * a weight2 * b+.
Geom.point_in_polygon_2D(point, polygon, check_border) ⇒ Boolean
Does the point lie inside the polygon. Ignore the Z coordinate of the point with respect to the polygon vertices.
Geom.tesselate(outer, *holes) ⇒ Array<Geom::Point3d>
Triangulates a planar polygon and returns a flat list of points, three per triangle. Supply the outer loop counterclockwise and hole loops clockwise.