Module: Geom
- Defined in:
- SketchUp/geom.rb
Overview
Lines and Planes are infinite.
The Geom module defines a number of Module methods that let you perform different geometric operations.
The methods in this module take lines and planes as arguments. There is no special class for representing lines or planes. Arrays are used for both.
A line can be represented as either an Array of a point and a vector, or as an Array of two points.
line1 = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)]
line2 = [Geom::Point3d.new(0, 0, 0), Geom::Point3d.new(0, 0, 100)]
A plane can be represented as either an Array of a point and a vector, or as an Array of 4 numbers that give the coefficients of a plane equation.
plane1 = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)]
plane2 = [0, 0, 1, 0]
There are several good books on 3D math if you are new to the concepts of a line, plane, and vector.
Defined Under Namespace
Classes: BoundingBox, Bounds2d, LatLong, OrientedBounds2d, Point2d, Point3d, PolygonMesh, Transformation, Transformation2d, UTM, Vector2d, Vector3d
Class Method Summary collapse
-
.closest_points(line1, line2) ⇒ Array(Geom::Point3d, Geom::Point3d)
The Geom.closest_points method is used to compute the closest points on two lines.
-
.fit_plane_to_points(*args) ⇒ Object
The Geom.fit_plane_to_points method is used to compute a plane that is a best fit to an array of points.
-
.intersect_line_line(line1, line2) ⇒ Geom::Point3d?
The Geom.intersect_line_line computes the intersection of two lines.
-
.intersect_line_plane(line, plane) ⇒ Geom::Point3d?
The Geom.intersect_line_plane method is used to compute the intersection of a line and a plane.
-
.intersect_plane_plane(plane1, plane2) ⇒ Array(Geom::Point3d, Geom::Vector3d)
The Geom.intersect_plane_plane method is used to compute the intersection of two planes.
-
.linear_combination(weight1, pt_or_vect1, weight2, pt_or_vect2) ⇒ Object
The Geom.linear_combination method is used to compute the linear combination of points or vectors.
-
.point_in_polygon_2D(point, *polygon, check_border) ⇒ Boolean
The Geom.point_in_polygon_2D method is used to determine whether a point is inside a polygon.
Class Method Details
.closest_points(line1, line2) ⇒ Array(Geom::Point3d, Geom::Point3d)
The closest_points method is used to compute the closest points on two lines.
line.
55 56 |
# File 'SketchUp/geom.rb', line 55 def self.closest_points(line1, line2) end |
.fit_plane_to_points(point1, point2, point3, ...) ⇒ Array(Geom::Point3d, Geom::Vector3d) .fit_plane_to_points(points) ⇒ Array(Geom::Point3d, Geom::Vector3d)
The fit_plane_to_points method is used to compute a plane that is a best fit to an array of points. If more than three points are given some of the points may not be on the plane.
The plane is returned as an Array of 4 numbers which are the coefficients of the plane equation Ax + By + Cz + D = 0.
84 85 |
# File 'SketchUp/geom.rb', line 84 def self.fit_plane_to_points(*args) end |
.intersect_line_line(line1, line2) ⇒ Geom::Point3d?
The intersect_line_line computes the intersection of two lines.
112 113 |
# File 'SketchUp/geom.rb', line 112 def self.intersect_line_line(line1, line2) end |
.intersect_line_plane(line, plane) ⇒ Geom::Point3d?
The intersect_line_plane method is used to compute the intersection of a line and a plane.
138 139 |
# File 'SketchUp/geom.rb', line 138 def self.intersect_line_plane(line, plane) end |
.intersect_plane_plane(plane1, plane2) ⇒ Array(Geom::Point3d, Geom::Vector3d)
The intersect_plane_plane method is used to compute the intersection of two planes.
164 165 |
# File 'SketchUp/geom.rb', line 164 def self.intersect_plane_plane(plane1, plane2) end |
.linear_combination(weight1, point1, weight2, point2) ⇒ Geom::Point3d .linear_combination(weight1, vector1, weight2, vector2) ⇒ Geom::Vector3d
The linear_combination method is used to compute the linear combination of points or vectors.
194 195 |
# File 'SketchUp/geom.rb', line 194 def self.linear_combination(weight1, pt_or_vect1, weight2, pt_or_vect2) end |
.point_in_polygon_2D(point, *polygon, check_border) ⇒ Boolean
The point_in_polygon_2D method is used to determine whether a point is inside a polygon. The z component of both the point you’re checking and the points in the polygon are ignored, effectively making it a 2-d check.
230 231 |
# File 'SketchUp/geom.rb', line 230 def self.point_in_polygon_2D(point, *polygon, check_border) end |