KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Functions
gr_find_shapes.h File Reference
#include <gr_cpp/gr_polymesh_plane.h>
#include <gr_cpp/gr_polygon.h>
#include <gr_cpp/gr_right_triangle_pair.h>
#include <m_cpp/m_int_vector.h>
#include <g_cpp/g_cylinder.h>
#include <g_cpp/g_cylinder_section.h>
#include <g_cpp/g_circle.h>
#include <vector>

Go to the source code of this file.

Namespaces

 kjb
 Classes and functions for dealing with trajectory files.
 

Functions

void kjb::get_plane_parameters (const Vector &normal, const Vector &point_on_plane, Vector &plane_params)
 Finds the coefficients of the plane of the form ax + by + cz + d = 0 given the normal vector and a point on the plane. More...
 
void kjb::get_plane_parameters (const Vector &pt1, const Vector &pt2, const Vector &pt3, Vector &plane_params)
 Finds the coefficients of the plane of the form ax + by + cz + d = 0 given three points on the plane. More...
 
bool kjb::check_if_faces_are_coplanar (const Vector &plane1_params, const Vector &plane2_params, double tolerance, double distTolerance=1.0)
 Checks if two faces in a polymesh are coplanar. More...
 
bool kjb::check_if_4_points_are_coplanar (const Vector &p1, const Vector &p2, const Vector &p3, const Vector &p4, double tolerance)
 Checks if 4 points are coplanar. More...
 
double kjb::get_angle_between_two_vectors (const Vector &plane1_params, const Vector &plane2_params) throw (Illegal_argument, KJB_error)
 Calculates the smaller angle between the normal vectors of two planes. The angle returned is in radians. More...
 
void kjb::find_planes (const Polymesh &p, std::vector< Polymesh_Plane > &plane)
 Finds all of the planes in a polymesh and stores each set of coefficients along with the corresponding face indices in a Polymesh_Plane. More...
 
void kjb::render_planes (const Polymesh &p, const std::vector< Polymesh_Plane > &planes)
 Renders each plane in a polymesh with a different color. More...
 
void kjb::find_all_circles_in_polymesh (Polymesh &p, std::vector< Circle_in_3d > &circles, std::vector< std::vector< Vector > > &points)
 Finds all of the circles and the points that lie on them in the polymesh. More...
 
void kjb::find_right_triangles (const std::vector< kjb::Polygon > &faces, Int_vector &mask)
 Creates an Int_vector mask representing the faces in a polymesh that are right triangles. More...
 
void kjb::find_rectangles (const std::vector< kjb::Polygon > &faces, const Int_vector &mask, const Polymesh &p, std::vector< Right_Triangle_Pair > &rectangles)
 Finds all pairs of right triangles in a polymesh that are coplanar, adjacent along their hypotenuses, and have the same vertices along the shared edge (i.e. the triangle pairs form a rectangle). More...
 
void kjb::create_rectangle_mask (const Polymesh &p, const std::vector< Right_Triangle_Pair > &rectangles, Int_vector &rectMask)
 Creates an Int_vector mask representing the faces in a polymesh that are part of a rectangle. More...
 
void kjb::find_adjacent_rectangles (const Polymesh &p, const Int_vector &cylMask, const Int_vector &rectMask, const std::vector< Right_Triangle_Pair > &rectangles, int startIndex, int rectIndex, int prevAdjFace, double width, double lengthTolerance, double &smallestAngle, double &largestAngle, double &sumAngles, std::vector< int > &cyl_indices, Vector &edge_pt1, Vector &edge_pt2, Vector &edge_pt1_adj, Vector &edge_pt_adj)
 Determines which rectangles are adjacent to eachother and if a group of adjacent rectangles form part of a cylinder. More...
 
void kjb::find_cylinders (const Polymesh &p, const std::vector< Right_Triangle_Pair > &rectangles, std::vector< std::vector< int > > &cyl_indices, std::vector< double > &cylSumAngles, std::vector< std::vector< Vector > > &cylEdgePoints)
 Determines which groups of faces in the polymesh form cylinders. More...
 
void kjb::find_top_and_bottom_points_of_cylinder (const Polymesh &p, const Int_vector &rectMask, const std::vector< Right_Triangle_Pair > &rectangles, const std::vector< int > &cyl_indices, std::vector< Vector > &top_points, std::vector< Vector > &bottom_points)
 Determines which points make up the 'top' and which points make up the 'bottom' of the cylinder specified by the provided polymesh face indices. More...
 
void kjb::find_centroid_of_3d_points (const std::vector< Vector > &points, Vector &centroid)
 Finds the center of a set of 3D points. More...
 
void kjb::fit_plane_to_3d_points (const std::vector< Vector > &points, const Vector &centroid, Vector &plane_params)
 Uses singular value decomposition (SVD) to fit a plane to a set of 3D points. More...
 
void kjb::project_points_onto_plane (std::vector< Vector > &points, const Vector &plane_params, const Vector &centroid, std::vector< Vector > &projected_points)
 Projects 3D points onto the best-fit 3D plane. More...
 
void kjb::translate_3d_plane_to_xy_plane (const std::vector< Vector > &points, const Vector &plane_params, std::vector< Vector > &translated_points, std::vector< Matrix > &transformMatrices)
 
void kjb::translate_xy_point_to_3d_plane (const Vector &point, const std::vector< Matrix > &transformMatrices, Vector &translated_point)
 
void kjb::fit_cylinder (const Polymesh &p, const Int_vector &rectMask, const std::vector< Right_Triangle_Pair > &rectangles, const std::vector< int > &cyl_indices, double cylAngle, const std::vector< Vector > &cylEdgePoints, Cylinder_section &cyl)
 Determines the parameters of the cylinder formed by a set of faces in the polymesh. More...
 
void kjb::find_cylinders_to_render_and_fit (char *faceFile, char *cylFile, const Polymesh &p, std::vector< Polymesh_Plane > &plane, std::vector< Cylinder_section > &cyl)
 
void kjb::find_cylinders_to_render (const Polymesh &p, std::vector< Polymesh_Plane > &plane)
 Renders each set of faces that forms a cylinder a different color. More...
 
void kjb::find_rectangles_to_render (const Polymesh &p, std::vector< Polymesh_Plane > &plane)
 Renders each pair of faces that forms a rectangle a different color. More...
 
void kjb::find_right_triangles_to_render (const Polymesh &p, std::vector< Polymesh_Plane > &plane)
 Renders each face that is a right triangle in a different color. More...
 
void kjb::find_adjacent_right_triangles_to_render (const Polymesh &p, std::vector< Polymesh_Plane > &plane)
 Renders each face that is a right triangle and adjacent to another face that is also a right triangle in a different color. More...