Module: AMS::Geometry
- Defined in:
- Documentation/ams/geometry.rb
Overview
Class Method Summary collapse
-
.angle_between_vectors(*args) ⇒ Numeric
The angle in radians.
-
.blend_colors(colors, ratio) ⇒ Sketchup::Color
Transition between multiple colors.
-
.calc_cubic_bezier_point(ratio, p0, p1, p2, p3) ⇒ Geom::Point3d
Compute point on cubic bezier curve.
-
.calc_cubic_bezier_slope(ratio, p0, p1, p2, p3) ⇒ Geom::Vector3d
Compute slope on cubic bezier curve.
-
.calc_edge_centre(edge) ⇒ Geom::Point3d
Calculate edge centre of mass.
-
.calc_face_centre(face) ⇒ Geom::Point3d
Calculate face centre of mass.
-
.deepray1(point, vector, chg = false) ⇒ Array<Array>
Cast a continuous ray that intersects with all the entities.
-
.deepray2(entities, point, vector, chg = false) ⇒ Array<Array>
Cast a continuous ray that intersects with the given entities only.
-
.deepray3(entities, point, vector, chg = false) ⇒ Array<Array>
Cast a continuous ray that intersects with all but the given entities.
-
.extract_matrix_scale(transformation) ⇒ Geom::Transformation
Normalize the scale of axes of a transformation matrix.
-
.get_matrix_scale(transformation) ⇒ Geom::Vector3d
Get the scale of axes of a transformation matrix.
-
.get_noncollinear_points(points) ⇒ Array<Geom::Point3d>?
Get three non-collinear points from an array of three or more points.
-
.get_plane_normal(plane) ⇒ Geom::Vector3d
Get plane normal.
-
.get_points_on_circle2d(origin, radius, num_seg = 16, rot_angle = 0.0) ⇒ Array<Geom::Point3d>
Get points of a two dimensional circle.
-
.get_points_on_circle3d(origin, normal, radius, num_seg = 16, rot_angle = 0) ⇒ Array<Geom::Point3d>
Get points of a three dimensional circle.
-
.get_unique_points(points) ⇒ Array<Geom::Point3d>
Get an array of unique points from an array of Point3d objects.
-
.intersect_ray_triangle(origin, direction, pt1, pt2, pt3) ⇒ Geom::Point3d?
Intersect ray with a triangle.
-
.is_matrix_flipped?(transformation) ⇒ Boolean
Determine whether a transformation matrix is flipped.
-
.is_matrix_uniform?(transformation) ⇒ Boolean
Determine whether a transformation matrix is uniform.
-
.is_point_on_edge?(point, edge) ⇒ Boolean
Determine whether a particular point in on edge.
-
.is_point_on_face?(point, face) ⇒ Boolean
Determine whether a particular point is on face.
-
.is_point_on_triangle?(point, pt1, pt2, pt3) ⇒ Boolean
Determine whether a particular point is on triangle.
-
.points_collinear?(points) ⇒ Boolean
Determine whether an array of points lie on the same line.
-
.points_coplanar?(points) ⇒ Boolean
Determine whether an array of points lie on the same plane.
-
.raytest1(entities, point, vector, chg = false) ⇒ Array?
Cast a ray through the model that intersects with the given entities only.
-
.raytest2(entities, point, vector, chg = false) ⇒ Array?
Cast a ray through the model that intersects with all but the given entities.
-
.raytest3(point, vector, chg = false) ⇒ Array?
Cast a ray that intersects with non-transparent faces only; a ray that passes through all the transparent faces and stops when hits a solid face.
-
.rotate_matrix_xaxis_to_dir(transformation, direction) ⇒ Geom::Transformation
Rotate a transformation matrix so that its X-axis aligns with a directing vector.
-
.rotate_matrix_yaxis_to_dir(transformation, direction) ⇒ Geom::Transformation
Rotate a transformation matrix so that its Y-axis aligns with a directing vector.
-
.rotate_matrix_zaxis_to_dir(transformation, direction) ⇒ Geom::Transformation
Rotate a transformation matrix so that its Z-axis aligns with a directing vector.
-
.rotate_vector(vector, normal, angle) ⇒ Geom::Vector3d
Rotate vector at a normal.
-
.scale_point(point, scale) ⇒ Geom::Point3d
Scale point.
-
.scale_vector(vector, scale) ⇒ Geom::Vector3d
Scale vector.
-
.set_matrix_scale(transformation, scale) ⇒ Geom::Transformation
Set the scale of axes of a transformation matrix.
-
.sort_polygon_points(points) ⇒ Array<Geom::Point3d>?
Sort an array of points in a counter clockwise direction.
-
.transition_camera(camera1, camera2, ratio) ⇒ Sketchup::Camera
Transition between two cameras.
-
.transition_color(color1, color2, ratio) ⇒ Sketchup::Color
Transition between two colors.
-
.transition_number(number1, number2, ratio) ⇒ Numeric
between 0.0 and 1.0.
-
.transition_point(point1, point2, ratio) ⇒ Geom::Point3d
Transition between two points.
-
.transition_transformation(transformation1, transformation2, ratio) ⇒ Geom::Transformation
Transition between two transformation matrices.
-
.transition_vector(vector1, vector2, ratio) ⇒ Geom::Vector3d
Transition between two vectors.
Class Method Details
.angle_between_vectors(vector1, vector2) ⇒ Numeric .angle_between_vectors(vector1, vector2, normal) ⇒ Numeric
Returns The angle in radians.
.blend_colors(colors, ratio) ⇒ Sketchup::Color
Transition between multiple colors.
.calc_cubic_bezier_point(ratio, p0, p1, p2, p3) ⇒ Geom::Point3d
Compute point on cubic bezier curve.
.calc_cubic_bezier_slope(ratio, p0, p1, p2, p3) ⇒ Geom::Vector3d
Compute slope on cubic bezier curve.
.calc_edge_centre(edge) ⇒ Geom::Point3d
Calculate edge centre of mass.
.calc_face_centre(face) ⇒ Geom::Point3d
Calculate face centre of mass.
.deepray1(point, vector, chg = false) ⇒ Array<Array>
Cast a continuous ray that intersects with all the entities.
.deepray2(entities, point, vector, chg = false) ⇒ Array<Array>
Cast a continuous ray that intersects with the given entities only.
.deepray3(entities, point, vector, chg = false) ⇒ Array<Array>
Cast a continuous ray that intersects with all but the given entities.
.extract_matrix_scale(transformation) ⇒ Geom::Transformation
Normalize the scale of axes of a transformation matrix.
.get_matrix_scale(transformation) ⇒ Geom::Vector3d
Get the scale of axes of a transformation matrix.
.get_noncollinear_points(points) ⇒ Array<Geom::Point3d>?
Get three non-collinear points from an array of three or more points.
.get_plane_normal(plane) ⇒ Geom::Vector3d
Get plane normal.
.get_points_on_circle2d(origin, radius, num_seg = 16, rot_angle = 0.0) ⇒ Array<Geom::Point3d>
Get points of a two dimensional circle.
.get_points_on_circle3d(origin, normal, radius, num_seg = 16, rot_angle = 0) ⇒ Array<Geom::Point3d>
Get points of a three dimensional circle.
.get_unique_points(points) ⇒ Array<Geom::Point3d>
Get an array of unique points from an array of Point3d objects.
.intersect_ray_triangle(origin, direction, pt1, pt2, pt3) ⇒ Geom::Point3d?
Intersect ray with a triangle.
.is_matrix_flipped?(transformation) ⇒ Boolean
Determine whether a transformation matrix is flipped.
.is_matrix_uniform?(transformation) ⇒ Boolean
Determine whether a transformation matrix is uniform. A uniform transformation matrix has its axes perpendicular to each other.
.is_point_on_edge?(point, edge) ⇒ Boolean
Determine whether a particular point in on edge.
.is_point_on_face?(point, face) ⇒ Boolean
Determine whether a particular point is on face.
.is_point_on_triangle?(point, pt1, pt2, pt3) ⇒ Boolean
Determine whether a particular point is on triangle.
.points_collinear?(points) ⇒ Boolean
Determine whether an array of points lie on the same line.
.points_coplanar?(points) ⇒ Boolean
Determine whether an array of points lie on the same plane.
.raytest1(entities, point, vector, chg = false) ⇒ Array?
Cast a ray through the model that intersects with the given entities only.
.raytest2(entities, point, vector, chg = false) ⇒ Array?
Cast a ray through the model that intersects with all but the given entities.
.raytest3(point, vector, chg = false) ⇒ Array?
A face is considered transparent if front or back side, depending on which the ray hits, has a material with alpha less than 255.
Cast a ray that intersects with non-transparent faces only; a ray that passes through all the transparent faces and stops when hits a solid face.
.rotate_matrix_xaxis_to_dir(transformation, direction) ⇒ Geom::Transformation
Rotate a transformation matrix so that its X-axis aligns with a directing vector.
.rotate_matrix_yaxis_to_dir(transformation, direction) ⇒ Geom::Transformation
Rotate a transformation matrix so that its Y-axis aligns with a directing vector.
.rotate_matrix_zaxis_to_dir(transformation, direction) ⇒ Geom::Transformation
Rotate a transformation matrix so that its Z-axis aligns with a directing vector.
.rotate_vector(vector, normal, angle) ⇒ Geom::Vector3d
Rotate vector at a normal.
.scale_point(point, scale) ⇒ Geom::Point3d
Scale point.
.scale_vector(vector, scale) ⇒ Geom::Vector3d
Scale vector.
.set_matrix_scale(transformation, scale) ⇒ Geom::Transformation
Set the scale of axes of a transformation matrix.
.sort_polygon_points(points) ⇒ Array<Geom::Point3d>?
Sort an array of points in a counter clockwise direction.
.transition_camera(camera1, camera2, ratio) ⇒ Sketchup::Camera
Transition between two cameras.
.transition_color(color1, color2, ratio) ⇒ Sketchup::Color
Transition between two colors.
.transition_number(number1, number2, ratio) ⇒ Numeric
between 0.0 and 1.0.
.transition_point(point1, point2, ratio) ⇒ Geom::Point3d
Transition between two points.
.transition_transformation(transformation1, transformation2, ratio) ⇒ Geom::Transformation
For the function to work properly, both transformation matrices must be uniform and non-flipped. They can, however, since version 3.5.0, have scaled axes.
Transition between two transformation matrices.
.transition_vector(vector1, vector2, ratio) ⇒ Geom::Vector3d
Unlike the transition_point function, this function rotates and scales vector1 to vector2 a specific ratio.
Transition between two vectors.