BRL-CAD
brep.cpp File Reference
#include "common.h"
#include <vector>
#include <list>
#include <map>
#include <stack>
#include <iostream>
#include <algorithm>
#include <set>
#include <utility>
#include "poly2tri/poly2tri.h"
#include "assert.h"
#include "vmath.h"
#include "bu/cv.h"
#include "bu/time.h"
#include "brep.h"
#include "dvec.h"
#include "raytrace.h"
#include "rtgeom.h"
#include "./brep_local.h"
#include "./brep_debug.h"
Include dependency graph for brep.cpp:

Go to the source code of this file.

Data Structures

struct  brep_build_bvh_parallel
 
class  brep_hit
 
class  RT_MemoryArchive
 
struct  brep_selectable_cv
 
struct  brep_cv
 
struct  brep_selection
 

Macros

#define BN_VMATH_PREFIX_INDICES   1
 
#define ROOT_TOL   1.E-7
 
#define MAX_BREP_SUBDIVISION_INTERSECTS   5
 

Typedefs

typedef std::list< brep_hitHitList
 
typedef std::pair< int, int > ip_t
 
typedef std::list< ip_tMissList
 

Enumerations

enum  brep_intersect_reason_t {
  BREP_INTERSECT_RIGHT_OF_EDGE = -5, BREP_INTERSECT_MISSED_EDGE = -4, BREP_INTERSECT_ROOT_ITERATION_LIMIT = -3, BREP_INTERSECT_ROOT_DIVERGED = -2,
  BREP_INTERSECT_OOB = -1, BREP_INTERSECT_TRIMMED = 0, BREP_INTERSECT_FOUND = 1
}
 

Functions

int rt_brep_bbox (struct rt_db_internal *ip, point_t *min, point_t *max)
 
int rt_brep_prep (struct soltab *stp, struct rt_db_internal *ip, struct rt_i *rtip)
 
void rt_brep_print (register const struct soltab *stp)
 
int rt_brep_shot (struct soltab *stp, register struct xray *rp, struct application *ap, struct seg *seghead)
 
void rt_brep_norm (register struct hit *hitp, struct soltab *stp, register struct xray *rp)
 
void rt_brep_curve (register struct curvature *cvp, register struct hit *hitp, struct soltab *stp)
 
int rt_brep_class (const struct soltab *stp, const fastf_t *min, const fastf_t *max, const struct bn_tol *tol)
 
void rt_brep_uv (struct application *ap, struct soltab *stp, register struct hit *hitp, register struct uvcoord *uvp)
 
void rt_brep_free (register struct soltab *stp)
 
int rt_brep_adaptive_plot (struct rt_db_internal *ip, const struct rt_view_info *info)
 
int rt_brep_plot (struct bu_list *vhead, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol, const struct rt_view_info *info)
 
int rt_brep_tess (struct nmgregion **r, struct model *m, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol)
 
int rt_brep_get (struct bu_vls *logstr, const struct rt_db_internal *intern, const char *attr)
 
int rt_brep_adjust (struct bu_vls *logstr, const struct rt_db_internal *intern, int argc, const char **argv)
 
int rt_brep_export5 (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip)
 
int rt_brep_import5 (struct rt_db_internal *ip, const struct bu_external *ep, register const fastf_t *mat, const struct db_i *dbip)
 
void rt_brep_ifree (struct rt_db_internal *ip)
 
int rt_brep_describe (struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local)
 
int rt_brep_tclget (Tcl_Interp *interp, const struct rt_db_internal *intern, const char *attr)
 
int rt_brep_tcladjust (Tcl_Interp *interp, struct rt_db_internal *intern, int argc, const char **argv)
 
int rt_brep_params (struct pc_pc_set *, const struct rt_db_internal *ip)
 
int rt_brep_boolean (struct rt_db_internal *out, const struct rt_db_internal *ip1, const struct rt_db_internal *ip2, db_op_t operation)
 
struct rt_selection_setrt_brep_find_selections (const struct rt_db_internal *ip, const struct rt_selection_query *query)
 
int rt_brep_process_selection (struct rt_db_internal *ip, const struct rt_selection *selection, const struct rt_selection_operation *op)
 
ON_Ray toXRay (struct xray *rp)
 
struct brep_specificbrep_specific_new ()
 
void brep_specific_delete (struct brep_specific *bs)
 
bool brep_pt_trimmed (pt2d_t pt, const ON_BrepFace &face)
 
double getVerticalTangent (const ON_Curve *curve, double min, double max)
 
double getHorizontalTangent (const ON_Curve *curve, double min, double max)
 
bool split_trims_hv_tangent (const ON_Curve *curve, ON_Interval &t, std::list< double > &list)
 
int brep_build_bvh (struct brep_specific *bs)
 
void rt_brep_print (const struct soltab *stp)
 
HIDDEN const char * BREP_INTERSECT_REASON (brep_intersect_reason_t index)
 
void utah_F (const ON_3dPoint &S, const ON_3dVector &p1, const double p1d, const ON_3dVector &p2, const double p2d, double &f1, double &f2)
 
void utah_Fu (const ON_3dVector &Su, const ON_3dVector &p1, const ON_3dVector &p2, double &d0, double &d1)
 
void utah_Fv (const ON_3dVector &Sv, const ON_3dVector &p1, const ON_3dVector &p2, double &d0, double &d1)
 
double utah_calc_t (const ON_Ray &r, ON_3dPoint &S)
 
void utah_pushBack (const ON_Surface *surf, ON_2dPoint &uv)
 
void utah_pushBack (const BBNode *sbv, ON_2dPoint &uv)
 
int utah_newton_solver (const BBNode *sbv, const ON_Surface *surf, const ON_Ray &r, ON_2dPoint *ouv, double *t, ON_3dVector *N, bool &converged, ON_2dPoint *suv, const int count, const int iu, const int iv)
 
int utah_newton_4corner_solver (const BBNode *sbv, const ON_Surface *surf, const ON_Ray &r, ON_2dPoint *ouv, double *t, ON_3dVector *N, bool &converged, int docorners)
 
bool utah_isTrimmed (ON_2dPoint uv, const ON_BrepFace *face)
 
int utah_brep_intersect (const BBNode *sbv, const ON_BrepFace *face, const ON_Surface *surf, pt2d_t &uv, ON_Ray &ray, HitList &hits)
 
HIDDEN int sign (double val)
 
bool containsNearMiss (HitList *hits)
 
bool containsNearHit (HitList *hits)
 
void rt_brep_norm (struct hit *hitp, struct soltab *stp, struct xray *rp)
 
void rt_brep_curve (struct curvature *cvp, struct hit *hitp, struct soltab *stp)
 
void plot_bbnode (BBNode *node, struct bu_list *vhead, int depth, int start, int limit)
 
double find_next_point (const ON_Curve *crv, double startdomval, double increment, double tolerance, int stepcount)
 
double find_next_trimming_point (const ON_Curve *crv, const ON_Surface *s, double startdomval, double increment, double tolerance, int stepcount)
 
bool near_equal (double first, double second)
 
void plot_sum_surface (struct bu_list *vhead, const ON_Surface *surf, int isocurveres, int gridres)
 
void plotisoUCheckForTrim (struct bu_list *vhead, SurfaceTree *st, fastf_t from, fastf_t to, fastf_t v)
 
void plotisoVCheckForTrim (struct bu_list *vhead, SurfaceTree *st, fastf_t from, fastf_t to, fastf_t u)
 
void plotisoU (struct bu_list *vhead, SurfaceTree *st, fastf_t from, fastf_t to, fastf_t v, int curveres)
 
void plotisoV (struct bu_list *vhead, SurfaceTree *st, fastf_t from, fastf_t to, fastf_t u, int curveres)
 
void plot_BBNode (struct bu_list *vhead, SurfaceTree *st, BBNode *node, int isocurveres, int gridres)
 
void plot_face_from_surface_tree (struct bu_list *vhead, SurfaceTree *st, int isocurveres, int gridres)
 
void getEdgePoints (const ON_BrepTrim &trim, fastf_t t1, ON_3dPoint &start_2d, ON_3dVector &start_tang, ON_3dPoint &start_3d, ON_3dVector &start_norm, fastf_t t2, ON_3dPoint &end_2d, ON_3dVector &end_tang, ON_3dPoint &end_3d, ON_3dVector &end_norm, fastf_t min_dist, fastf_t max_dist, fastf_t within_dist, fastf_t cos_within_ang, std::map< double, ON_3dPoint * > &param_points)
 
std::map< double, ON_3dPoint * > * getEdgePoints (ON_BrepTrim &trim, fastf_t max_dist, const struct rt_tess_tol *ttol, const struct bn_tol *tol, const struct rt_view_info *info)
 
void getSurfacePoints (const ON_Surface *s, fastf_t u1, fastf_t u2, fastf_t v1, fastf_t v2, fastf_t min_dist, fastf_t within_dist, fastf_t cos_within_ang, ON_2dPointArray &on_surf_points, bool left, bool below)
 
void getSurfacePoints (ON_BrepFace &face, const struct rt_tess_tol *ttol, const struct bn_tol *tol, const struct rt_view_info *info, ON_2dPointArray &on_surf_points)
 
void getUVCurveSamples (const ON_Surface *s, const ON_Curve *curve, fastf_t t1, ON_3dPoint &start_2d, ON_3dVector &start_tang, ON_3dPoint &start_3d, ON_3dVector &start_norm, fastf_t t2, ON_3dPoint &end_2d, ON_3dVector &end_tang, ON_3dPoint &end_3d, ON_3dVector &end_norm, fastf_t min_dist, fastf_t max_dist, fastf_t within_dist, fastf_t cos_within_ang, std::map< double, ON_3dPoint * > &param_points)
 
std::map< double, ON_3dPoint * > * getUVCurveSamples (const ON_Surface *surf, const ON_Curve *curve, fastf_t max_dist, const struct rt_tess_tol *ttol, const struct bn_tol *tol, const struct rt_view_info *info)
 
int number_of_seam_crossings (const ON_Surface *surf, ON_SimpleArray< BrepTrimPoint > &brep_trim_points)
 
bool LoopStraddlesDomain (const ON_Surface *surf, ON_SimpleArray< BrepTrimPoint > &brep_loop_points)
 
int is_entering (const ON_Surface *surf, const ON_SimpleArray< BrepTrimPoint > &brep_loop_points)
 
bool shift_loop_straddled_over_seam (const ON_Surface *surf, ON_SimpleArray< BrepTrimPoint > &brep_loop_points, double same_point_tolerance)
 
bool extend_over_seam_crossings (const ON_Surface *surf, ON_SimpleArray< BrepTrimPoint > &brep_loop_points)
 
void poly2tri_CDT (struct bu_list *vhead, ON_BrepFace &face, const struct rt_tess_tol *ttol, const struct bn_tol *tol, const struct rt_view_info *info, bool watertight=false, int plottype=0, int num_points=-1.0)
 
void plot_face_trim (struct bu_list *vhead, ON_BrepFace &face, int plotres, bool dim3d)
 
int rt_brep_plot_poly (struct bu_list *vhead, const struct db_full_path *pathp, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol, const struct rt_view_info *info)
 
int rt_brep_import5 (struct rt_db_internal *ip, const struct bu_external *ep, const fastf_t *mat, const struct db_i *dbip)
 
bool cmp_cv_startdist (brep_selectable_cv *c1, brep_selectable_cv *c2)
 
struct rt_selectionnew_cv_selection (brep_selectable_cv *s)