Revision: 68940
http://sourceforge.net/p/brlcad/code/68940
Author: brlcad
Date: 2016-09-30 04:15:54 +0000 (Fri, 30 Sep 2016)
Log Message:
-----------
ws indent cleanup
Modified Paths:
--------------
brlcad/trunk/src/libbrep/BBNode.cpp
brlcad/trunk/src/libbrep/BRNode.cpp
brlcad/trunk/src/libbrep/Subcurve.cpp
brlcad/trunk/src/libbrep/Subsurface.cpp
brlcad/trunk/src/libbrep/boolean.cpp
brlcad/trunk/src/libbrep/brep_except.h
brlcad/trunk/src/libbrep/libbrep_brep_tools.cpp
brlcad/trunk/src/libbrep/opennurbs_ext.cpp
brlcad/trunk/src/libbrep/px_event.cpp
brlcad/trunk/src/libbrep/shape_recognition.cpp
brlcad/trunk/src/libbrep/shape_recognition.h
brlcad/trunk/src/libbrep/shape_recognition_cone.cpp
brlcad/trunk/src/libbrep/shape_recognition_pipeline.cpp
brlcad/trunk/src/libbrep/shape_recognition_planar.cpp
brlcad/trunk/src/libbrep/shape_recognition_sphere.cpp
brlcad/trunk/src/libbrep/shape_recognition_torus.cpp
brlcad/trunk/src/libbrep/shape_recognition_util.cpp
Modified: brlcad/trunk/src/libbrep/BBNode.cpp
===================================================================
--- brlcad/trunk/src/libbrep/BBNode.cpp 2016-09-30 04:06:48 UTC (rev 68939)
+++ brlcad/trunk/src/libbrep/BBNode.cpp 2016-09-30 04:15:54 UTC (rev 68940)
@@ -49,12 +49,12 @@
BBNode::BBNode(
- const CurveTree *ct,
- const ON_BoundingBox &node,
- const ON_Interval &u,
- const ON_Interval &v,
- bool checkTrim,
- bool trimmed):
+ const CurveTree *ct,
+ const ON_BoundingBox &node,
+ const ON_Interval &u,
+ const ON_Interval &v,
+ bool checkTrim,
+ bool trimmed):
m_node(node),
m_u(u),
m_v(v),
@@ -181,7 +181,7 @@
}
/* go ahead and solve hits behind us
if (tfar < 0) untrimmedresult = false;
- */
+ */
}
}
if (LIKELY(tnear_opt != NULL && tfar_opt != NULL)) {
@@ -211,6 +211,7 @@
return intersects;
}
+
bool
BBNode::containsUV(const ON_2dPoint &uv) const
{
@@ -221,6 +222,7 @@
}
}
+
int
BBNode::depth() const
{
@@ -231,6 +233,7 @@
return d;
}
+
void
BBNode::getLeaves(std::list<const BBNode *> &out_leaves) const
{
@@ -243,6 +246,7 @@
}
}
+
const BBNode *
BBNode::closer(const ON_3dPoint &pt, const BBNode *left, const BBNode *right)
const
{
@@ -256,6 +260,7 @@
}
}
+
ON_2dPoint
BBNode::getClosestPointEstimate(const ON_3dPoint &pt) const
{
@@ -263,13 +268,14 @@
return getClosestPointEstimate(pt, u, v);
}
+
ON_2dPoint
BBNode::getClosestPointEstimate(const ON_3dPoint &pt, ON_Interval &u,
ON_Interval &v) const
{
if (isLeaf()) {
double uvs[5][2] = {{m_u.Min(), m_v.Min()}, {m_u.Max(), m_v.Min()},
- {m_u.Max(), m_v.Max()}, {m_u.Min(), m_v.Max()},
- {m_u.Mid(), m_v.Mid()}
+ {m_u.Max(), m_v.Max()}, {m_u.Min(), m_v.Max()},
+ {m_u.Mid(), m_v.Mid()}
}; /* include the estimate */
ON_3dPoint corners[5];
const ON_Surface *surf = get_face().SurfaceOf();
@@ -316,6 +322,7 @@
}
}
+
int
BBNode::getLeavesBoundingPoint(const ON_3dPoint &pt, std::list<const BBNode *>
&out) const
{
@@ -340,6 +347,7 @@
}
}
+
bool
BBNode::isTrimmed(const ON_2dPoint &uv, const BRNode **closest, double
&closesttrim, double within_distance_tol) const
{
@@ -456,6 +464,7 @@
}
}
+
void
BBNode::getTrimsAbove(const ON_2dPoint &uv, std::list<const BRNode *>
&out_leaves) const
{
@@ -471,6 +480,7 @@
}
}
+
void BBNode::BuildBBox()
{
if (!m_stl->m_children.empty()) {
@@ -490,6 +500,7 @@
}
}
+
bool
BBNode::prepTrims()
{
@@ -581,6 +592,7 @@
}
}
+
// Local Variables:
// tab-width: 8
// mode: C++
Modified: brlcad/trunk/src/libbrep/BRNode.cpp
===================================================================
--- brlcad/trunk/src/libbrep/BRNode.cpp 2016-09-30 04:06:48 UTC (rev 68939)
+++ brlcad/trunk/src/libbrep/BRNode.cpp 2016-09-30 04:15:54 UTC (rev 68940)
@@ -28,15 +28,15 @@
BRNode::BRNode(
- const ON_Curve *curve,
- int trim_index,
- int adj_face_index,
- const ON_BoundingBox &node,
- const ON_BrepFace *face,
- const ON_Interval &t,
- bool innerTrim,
- bool checkTrim,
- bool trimmed) :
+ const ON_Curve *curve,
+ int trim_index,
+ int adj_face_index,
+ const ON_BoundingBox &node,
+ const ON_BrepFace *face,
+ const ON_Interval &t,
+ bool innerTrim,
+ bool checkTrim,
+ bool trimmed) :
m_node(node),
m_v(),
m_adj_face_index(adj_face_index),
@@ -131,15 +131,15 @@
m_start(ON_3dPoint::UnsetPoint),
m_end(ON_3dPoint::UnsetPoint)
{
- for (int i = 0; i < 3; i++) {
- double d = m_node.m_max[i] - m_node.m_min[i];
- if (NEAR_ZERO(d, ON_ZERO_TOLERANCE)) {
- m_node.m_min[i] -= 0.001;
- m_node.m_max[i] += 0.001;
- }
+ for (int i = 0; i < 3; i++) {
+ double d = m_node.m_max[i] - m_node.m_min[i];
+ if (NEAR_ZERO(d, ON_ZERO_TOLERANCE)) {
+ m_node.m_min[i] -= 0.001;
+ m_node.m_max[i] += 0.001;
}
- m_start = m_node.m_min;
- m_end = m_node.m_max;
+ }
+ m_start = m_node.m_min;
+ m_end = m_node.m_max;
}
@@ -257,6 +257,7 @@
return d;
}
+
void
BRNode::getLeaves(std::list<const BRNode *> &out_leaves) const
{
@@ -269,6 +270,7 @@
}
}
+
const BRNode *
BRNode::closer(const ON_3dPoint &pt, const BRNode *left, const BRNode *right)
const
{
@@ -282,6 +284,7 @@
}
}
+
bool
BRNode::isTrimmed(const ON_2dPoint &uv, double &trimdist) const
{
@@ -316,6 +319,7 @@
}
}
+
ON_2dPoint
BRNode::getClosestPointEstimate(const ON_3dPoint &pt) const
{
@@ -323,15 +327,16 @@
return getClosestPointEstimate(pt, u, v);
}
+
ON_2dPoint
BRNode::getClosestPointEstimate(const ON_3dPoint &pt, ON_Interval &u,
ON_Interval &v) const
{
if (isLeaf()) {
double uvs[5][2] = {{m_u.Min(), m_v.Min()}, /* include the corners for
an easy refinement */
- {m_u.Max(), m_v.Min()},
- {m_u.Max(), m_v.Max()},
- {m_u.Min(), m_v.Max()},
- {m_u.Mid(), m_v.Mid()}
+ {m_u.Max(), m_v.Min()},
+ {m_u.Max(), m_v.Max()},
+ {m_u.Min(), m_v.Max()},
+ {m_u.Mid(), m_v.Mid()}
}; /* include the estimate */
ON_3dPoint corners[5];
const ON_Surface *surf = m_face->SurfaceOf();
@@ -378,6 +383,7 @@
}
}
+
fastf_t
BRNode::getLinearEstimateOfV(fastf_t u) const
{
@@ -385,6 +391,7 @@
return v;
}
+
fastf_t
BRNode::getCurveEstimateOfV(fastf_t u, fastf_t tol) const
{
@@ -472,11 +479,12 @@
}
if (cnt > 999) {
bu_log("getCurveEstimateOfV(): estimate of 'v' given a trim curve and "
- "'u' did not converge within iteration bound(%d).\n", cnt);
+ "'u' did not converge within iteration bound(%d).\n", cnt);
}
return p[Y];
}
+
fastf_t
BRNode::getCurveEstimateOfU(fastf_t v, fastf_t tol) const
{
@@ -555,12 +563,13 @@
}
if (cnt > 999) {
bu_log("getCurveEstimateOfV(): estimate of 'u' given a trim curve and "
- "'v' did not converge within iteration bound(%d).\n", cnt);
+ "'v' did not converge within iteration bound(%d).\n", cnt);
}
return p[X];
}
}
+
// Local Variables:
// tab-width: 8
// mode: C++
Modified: brlcad/trunk/src/libbrep/Subcurve.cpp
===================================================================
--- brlcad/trunk/src/libbrep/Subcurve.cpp 2016-09-30 04:06:48 UTC (rev
68939)
+++ brlcad/trunk/src/libbrep/Subcurve.cpp 2016-09-30 04:15:54 UTC (rev
68940)
@@ -27,6 +27,7 @@
m_children[0] = m_children[1] = NULL;
}
+
Subcurve::Subcurve(ON_Curve *curve)
{
m_curve = curve;
@@ -40,6 +41,7 @@
m_children[0] = m_children[1] = NULL;
}
+
Subcurve::Subcurve(const Subcurve &_scurve)
{
m_islinear = _scurve.m_islinear;
@@ -49,6 +51,7 @@
SetBBox(_scurve.m_node);
}
+
Subcurve::~Subcurve()
{
for (int i = 0; i < 2; i++) {
@@ -59,6 +62,7 @@
delete m_curve;
}
+
int
Subcurve::Split()
{
@@ -88,6 +92,7 @@
return 0;
}
+
void
Subcurve::GetBBox(ON_3dPoint &min, ON_3dPoint &max)
{
@@ -95,12 +100,14 @@
max = m_node.m_max;
}
+
void
Subcurve::SetBBox(const ON_BoundingBox &bbox)
{
m_node = bbox;
}
+
bool
Subcurve::IsPointIn(const ON_3dPoint &pt, double tolerance /* = 0.0 */)
{
@@ -109,6 +116,7 @@
return new_bbox.IsPointIn(pt);
}
+
bool
Subcurve::Intersect(const Subcurve &other,
double tolerance /* = 0.0 */,
@@ -124,6 +132,7 @@
return ret;
}
+
// Local Variables:
// tab-width: 8
// mode: C++
Modified: brlcad/trunk/src/libbrep/Subsurface.cpp
===================================================================
--- brlcad/trunk/src/libbrep/Subsurface.cpp 2016-09-30 04:06:48 UTC (rev
68939)
+++ brlcad/trunk/src/libbrep/Subsurface.cpp 2016-09-30 04:15:54 UTC (rev
68940)
@@ -27,6 +27,7 @@
m_children[0] = m_children[1] = m_children[2] = m_children[3] = NULL;
}
+
Subsurface::Subsurface(ON_Surface *surf)
{
m_surf = surf;
@@ -41,6 +42,7 @@
m_children[0] = m_children[1] = m_children[2] = m_children[3] = NULL;
}
+
Subsurface::Subsurface(const Subsurface &_ssurf)
{
m_surf = _ssurf.m_surf->Duplicate();
@@ -51,6 +53,7 @@
SetBBox(_ssurf.m_node);
}
+
Subsurface::~Subsurface()
{
for (int i = 0; i < 4; i++) {
@@ -61,6 +64,7 @@
delete m_surf;
}
+
int
Subsurface::Split()
{
@@ -112,6 +116,7 @@
return 0;
}
+
void
Subsurface::GetBBox(ON_3dPoint &min, ON_3dPoint &max)
{
@@ -119,6 +124,7 @@
max = m_node.m_max;
}
+
void
Subsurface::SetBBox(const ON_BoundingBox &bbox)
{
@@ -136,6 +142,7 @@
}
}
+
bool
Subsurface::IsPointIn(const ON_3dPoint &pt, double tolerance /* = 0.0 */)
{
@@ -144,11 +151,12 @@
return new_bbox.IsPointIn(pt);
}
+
bool
Subsurface::Intersect(
- const Subcurve &curve,
- double tolerance /* = 0.0 */,
- ON_BoundingBox *intersection /* = NULL */) const
+ const Subcurve &curve,
+ double tolerance /* = 0.0 */,
+ ON_BoundingBox *intersection /* = NULL */) const
{
ON_3dVector vtol(tolerance, tolerance, tolerance);
ON_BoundingBox new_bbox(m_node.m_min - vtol, m_node.m_max + vtol);
@@ -160,11 +168,12 @@
return ret;
}
+
bool
Subsurface::Intersect(
- const Subsurface &surf,
- double tolerance /* = 0.0 */,
- ON_BoundingBox *intersection /* = NULL */) const
+ const Subsurface &surf,
+ double tolerance /* = 0.0 */,
+ ON_BoundingBox *intersection /* = NULL */) const
{
ON_3dVector vtol(tolerance, tolerance, tolerance);
ON_BoundingBox new_bbox(m_node.m_min - vtol, m_node.m_max + vtol);
@@ -176,6 +185,7 @@
return ret;
}
+
// Local Variables:
// tab-width: 8
// mode: C++
Modified: brlcad/trunk/src/libbrep/boolean.cpp
===================================================================
--- brlcad/trunk/src/libbrep/boolean.cpp 2016-09-30 04:06:48 UTC (rev
68939)
+++ brlcad/trunk/src/libbrep/boolean.cpp 2016-09-30 04:15:54 UTC (rev
68940)
@@ -99,6 +99,7 @@
}
};
+
HIDDEN void
append_to_polycurve(ON_Curve *curve, ON_PolyCurve &polycurve);
// We link the SSICurves that share an endpoint, and form this new structure,
@@ -319,6 +320,7 @@
}
};
+
HIDDEN int
loop_t_compare(const IntersectPoint *p1, const IntersectPoint *p2)
{
@@ -396,7 +398,7 @@
}
}
if (ret && (polycurve->PointAtStart().DistanceTo(polycurve->PointAtEnd())
>= ON_ZERO_TOLERANCE ||
- !polycurve->IsClosed()))
+ !polycurve->IsClosed()))
{
bu_log("The input loop is not closed.\n");
ret = false;
@@ -406,7 +408,7 @@
// Check whether the loop is degenerated.
ON_BoundingBox bbox = polycurve->BoundingBox();
ret = !ON_NearZero(bbox.Diagonal().Length(), tolerance)
- && !polycurve->IsLinear(tolerance);
+ && !polycurve->IsLinear(tolerance);
}
if (delete_curve) {
@@ -416,11 +418,13 @@
return ret;
}
+
enum {
OUTSIDE_OR_ON_LOOP,
INSIDE_OR_ON_LOOP
};
+
// Returns whether the point is inside/on or outside/on the loop
// boundary.
//
@@ -502,18 +506,21 @@
return false;
}
+
HIDDEN bool
is_point_inside_loop(const ON_2dPoint &pt, const ON_SimpleArray<ON_Curve *>
&loop)
{
return (point_loop_location(pt, loop) == INSIDE_OR_ON_LOOP) &&
!is_point_on_loop(pt, loop);
}
+
HIDDEN bool
is_point_outside_loop(const ON_2dPoint &pt, const ON_SimpleArray<ON_Curve *>
&loop)
{
return (point_loop_location(pt, loop) == OUTSIDE_OR_ON_LOOP) &&
!is_point_on_loop(pt, loop);
}
+
HIDDEN ON_Interval
union_intervals(const ON_SimpleArray<ON_Interval> &intervals)
{
@@ -527,6 +534,7 @@
return union_interval;
}
+
HIDDEN ON_Interval
intersect_intervals(const ON_Interval &interval1, const ON_Interval &interval2)
{
@@ -537,6 +545,7 @@
return intersection_interval;
}
+
HIDDEN void
replace_curve_with_subcurve(ON_Curve *&curve, const ON_Interval &interval)
{
@@ -546,10 +555,11 @@
curve = subcurve;
} catch (InvalidInterval &) {
throw GeometryGenerationError("replace_curve_with_subcurve(): NULL "
- "subcurve\n");
+ "subcurve\n");
}
}
+
HIDDEN ON_SimpleArray<ON_Interval>
get_curve_intervals_inside_or_on_face(
ON_Curve *curve2D,
@@ -640,18 +650,21 @@
return final_intervals;
}
+
HIDDEN int
compare_interval(const ON_Interval *a, const ON_Interval *b)
{
return a->Compare(*b);
}
+
struct IntervalPoints {
ON_3dPoint min;
ON_3dPoint mid;
ON_3dPoint max;
};
+
class IntervalParams {
public:
double min;
@@ -674,6 +687,7 @@
}
};
+
// given parameters in a curve interval, create new interval
// parameters that reflect the the non-degenerate (different
// dimensioned) curve interval used to generate the curve parameters
@@ -718,6 +732,7 @@
return interval_t;
}
+
enum seam_location {SEAM_NONE, SEAM_ALONG_V, SEAM_ALONG_U, SEAM_ALONG_UV};
@@ -763,7 +778,7 @@
// get interval midpoint in uv space
ON_ClassArray<ON_PX_EVENT> events;
ON_3dPoint midpt = surf->PointAt(interval_pts.mid.x,
- interval_pts.mid.y);
+ interval_pts.mid.y);
ON_Intersect(midpt, *surf, events, INTERSECTION_TOL);
if (events.Count() == 1) {
@@ -809,6 +824,7 @@
return interval_pts;
}
+
HIDDEN IntervalPoints
interval_2d_to_uv(
const ON_Interval &interval_2d,
@@ -824,6 +840,7 @@
return uv_interval_from_points(pts, surf);
}
+
HIDDEN std::pair<IntervalPoints, IntervalPoints>
interval_2d_to_2uv(
const ON_Interval &interval_2d,
@@ -842,6 +859,7 @@
return out;
}
+
HIDDEN IntervalPoints
points_uv_to_3d(
const IntervalPoints &interval_uv,
@@ -856,6 +874,7 @@
return pts_3d;
}
+
HIDDEN IntervalParams
points_3d_to_params_3d(
const IntervalPoints &pts_3d,
@@ -878,6 +897,7 @@
return params_3d;
}
+
HIDDEN std::vector<ON_Interval>
interval_2d_to_3d(
const ON_Interval &interval,
@@ -937,7 +957,7 @@
if (surf_seam == SEAM_ALONG_U || surf_seam ==
SEAM_ALONG_UV) {
ON_Interval vdom = surf->Domain(1);
if (ON_NearZero(surf_pt.y - vdom.Min(),
- ON_ZERO_TOLERANCE)) {
+ ON_ZERO_TOLERANCE)) {
surf_pt.y = vdom.Max();
} else {
surf_pt.y = vdom.Min();
@@ -946,7 +966,7 @@
if (surf_seam == SEAM_ALONG_V || surf_seam ==
SEAM_ALONG_UV) {
ON_Interval udom = surf->Domain(0);
if (ON_NearZero(surf_pt.x - udom.Min(),
- ON_ZERO_TOLERANCE)) {
+ ON_ZERO_TOLERANCE)) {
surf_pt.x = udom.Max();
} else {
surf_pt.x = udom.Min();
@@ -971,7 +991,7 @@
// split 2d interval at seam point
std::pair<IntervalPoints, IntervalPoints> halves =
interval_2d_to_2uv(interval, curve2d, surf,
- split_t[i]);
+ split_t[i]);
// convert new intervals to 3d curve intervals
IntervalPoints left_3d, right_3d;
@@ -1069,6 +1089,7 @@
return interval_2d;
}
+
HIDDEN void
get_subcurves_inside_faces(
ON_SimpleArray<ON_Curve *> &subcurves_on1,
@@ -1134,26 +1155,26 @@
ON_SimpleArray<ON_Interval> intervals1, intervals2;
intervals1 = get_curve_intervals_inside_or_on_face(event->m_curveA,
- face1_loops, INTERSECTION_TOL);
+ face1_loops,
INTERSECTION_TOL);
intervals2 = get_curve_intervals_inside_or_on_face(event->m_curveB,
- face2_loops, INTERSECTION_TOL);
+ face2_loops,
INTERSECTION_TOL);
// get subcurves for each face
for (int i = 0; i < intervals1.Count(); ++i) {
// convert interval on face 1 to equivalent interval on face 2
std::vector<ON_Interval> intervals_3d;
intervals_3d = interval_2d_to_3d(intervals1[i], event->m_curveA,
- event->m_curve3d, &brep1->m_F[face_i1]);
+ event->m_curve3d,
&brep1->m_F[face_i1]);
for (size_t j = 0; j < intervals_3d.size(); ++j) {
ON_Interval interval_on2 = interval_3d_to_2d(intervals_3d[j],
- event->m_curveB, event->m_curve3d, &brep2->m_F[face_i2]);
+ event->m_curveB,
event->m_curve3d, &brep2->m_F[face_i2]);
if (interval_on2.IsValid()) {
// create subcurve from interval
try {
ON_Curve *subcurve_on2 = sub_curve(event->m_curveB,
- interval_on2.Min(), interval_on2.Max());
+ interval_on2.Min(),
interval_on2.Max());
subcurves_on2.Append(subcurve_on2);
} catch (InvalidInterval &e) {
@@ -1167,16 +1188,16 @@
// convert interval on face 1 to equivalent interval on face 2
std::vector<ON_Interval> intervals_3d;
intervals_3d = interval_2d_to_3d(intervals2[i], event->m_curveB,
- event->m_curve3d, &brep2->m_F[face_i2]);
+ event->m_curve3d,
&brep2->m_F[face_i2]);
for (size_t j = 0; j < intervals_3d.size(); ++j) {
ON_Interval interval_on1 = interval_3d_to_2d(intervals_3d[j],
- event->m_curveA, event->m_curve3d, &brep1->m_F[face_i1]);
+ event->m_curveA,
event->m_curve3d, &brep1->m_F[face_i1]);
if (interval_on1.IsValid()) {
// create subcurve from interval
try {
ON_Curve *subcurve_on1 = sub_curve(event->m_curveA,
- interval_on1.Min(), interval_on1.Max());
+ interval_on1.Min(),
interval_on1.Max());
subcurves_on1.Append(subcurve_on1);
} catch (InvalidInterval &e) {
@@ -1188,6 +1209,7 @@
}
}
+
HIDDEN double
bbox_diagonal_length(ON_Curve *curve)
{
@@ -1203,6 +1225,7 @@
return len;
}
+
HIDDEN void
split_curve(ON_Curve *&left, ON_Curve *&right, const ON_Curve *in, double t)
{
@@ -1218,12 +1241,13 @@
}
}
+
HIDDEN double
configure_for_linking(
- LinkedCurve *&first,
- LinkedCurve *&second,
- LinkedCurve &in1,
- LinkedCurve &in2)
+ LinkedCurve *&first,
+ LinkedCurve *&second,
+ LinkedCurve &in1,
+ LinkedCurve &in2)
{
double dist_s1s2 = in1.PointAtStart().DistanceTo(in2.PointAtStart());
double dist_s1e2 = in1.PointAtStart().DistanceTo(in2.PointAtEnd());
@@ -1255,12 +1279,14 @@
return min_dist;
}
+
struct LinkedCurveX {
int ssi_idx_a;
int ssi_idx_b;
ON_SimpleArray<ON_X_EVENT> events;
};
+
HIDDEN ON_ClassArray<LinkedCurve>
get_joinable_ssi_curves(const ON_SimpleArray<SSICurve> &in)
{
@@ -1310,7 +1336,7 @@
for (int l = 0; l < 2; ++l) {
if (ON_NearZero(dom[k].m_t[l] - range[k].m_t[l],
- ON_ZERO_TOLERANCE)) {
+ ON_ZERO_TOLERANCE)) {
range[k].m_t[l] = dom[k].m_t[l];
}
}
@@ -1402,6 +1428,7 @@
return out;
}
+
HIDDEN ON_ClassArray<LinkedCurve>
link_curves(const ON_SimpleArray<SSICurve> &in)
{
@@ -1535,6 +1562,7 @@
}
};
+
class CurvePointAbsoluteCompare {
public:
bool
@@ -1547,6 +1575,7 @@
}
};
+
CurvePoint::Location
CurvePoint::PointLoopLocation(
ON_2dPoint pt,
@@ -1561,6 +1590,7 @@
return CurvePoint::INSIDE;
}
+
class CurveSegment {
public:
ON_SimpleArray<ON_Curve *> orig_loop;
@@ -1605,20 +1635,20 @@
if (ON_NearZero(from.curve_t - from_dom.m_t[1], INTERSECTION_TOL)) {
// starting at end of 'from' same as starting at start of 'to'
ON_Curve *seg_curve = sub_curve(to_curve, to_dom.m_t[0],
- to.curve_t);
+ to.curve_t);
return seg_curve;
}
if (ON_NearZero(to.curve_t - to_dom.m_t[0], INTERSECTION_TOL)) {
// ending at start of 'to' same as ending at end of 'from'
ON_Curve *seg_curve = sub_curve(from_curve, from.curve_t,
- from_dom.m_t[1]);
+ from_dom.m_t[1]);
return seg_curve;
}
ON_PolyCurve *pcurve = new ON_PolyCurve();
append_to_polycurve(sub_curve(from_curve, from.curve_t,
- from_dom.m_t[1]), *pcurve);
+ from_dom.m_t[1]), *pcurve);
append_to_polycurve(sub_curve(to_curve, to_dom.m_t[0], to.curve_t),
- *pcurve);
+ *pcurve);
return pcurve;
}
@@ -1635,7 +1665,7 @@
double length = 0.0;
if (seg_curve->IsLinear(INTERSECTION_TOL)) {
length = seg_curve->PointAtStart().DistanceTo(
- seg_curve->PointAtEnd());
+ seg_curve->PointAtEnd());
} else {
double min[3] = {0.0, 0.0, 0.0};
double max[3] = {0.0, 0.0, 0.0};
@@ -1654,6 +1684,7 @@
}
};
+
class LoopBooleanResult {
public:
std::vector<ON_SimpleArray<ON_Curve *> > outerloops;
@@ -1675,6 +1706,7 @@
}
};
+
#define LOOP_DIRECTION_CCW 1
#define LOOP_DIRECTION_CW -1
#define LOOP_DIRECTION_NONE 0
@@ -1694,6 +1726,7 @@
return false;
}
+
HIDDEN void
close_small_gaps(ON_SimpleArray<ON_Curve *> &loop)
{
@@ -1708,6 +1741,7 @@
close_small_gap(loop, loop.Count() - 1, 0);
}
+
ON_Curve *
get_loop_curve(const ON_SimpleArray<ON_Curve *> &loop)
{
@@ -1718,6 +1752,7 @@
return pcurve;
}
+
std::list<ON_SimpleArray<ON_Curve *> >::iterator
find_innerloop(std::list<ON_SimpleArray<ON_Curve *> > &loops)
{
@@ -1734,6 +1769,7 @@
return loops.end();
}
+
bool
set_loop_direction(ON_SimpleArray<ON_Curve *> &loop, int dir)
{
@@ -1758,6 +1794,7 @@
return true;
}
+
void
add_point_to_set(std::multiset<CurvePoint> &set, CurvePoint pt)
{
@@ -1766,6 +1803,7 @@
}
}
+
std::multiset<CurveSegment>
make_segments(
std::multiset<CurvePoint> &curve1_points,
@@ -1788,7 +1826,7 @@
}
if (from.location == CurvePoint::BOUNDARY &&
- to.location == CurvePoint::BOUNDARY)
+ to.location == CurvePoint::BOUNDARY)
{
ON_Curve *seg_curve = loop1[from.loop_index];
@@ -1797,7 +1835,7 @@
end_t = seg_curve->Domain().m_t[1];
}
ON_2dPoint seg_midpt = seg_curve->PointAt(
- ON_Interval(from.curve_t, end_t).Mid());
+ ON_Interval(from.curve_t, end_t).Mid());
CurvePoint::Location midpt_location =
CurvePoint::PointLoopLocation(seg_midpt, loop2);
@@ -1808,11 +1846,11 @@
new_seg.location = CurveSegment::OUTSIDE;
}
} else if (from.location == CurvePoint::INSIDE ||
- to.location == CurvePoint::INSIDE)
+ to.location == CurvePoint::INSIDE)
{
new_seg.location = CurveSegment::INSIDE;
} else if (from.location == CurvePoint::OUTSIDE ||
- to.location == CurvePoint::OUTSIDE)
+ to.location == CurvePoint::OUTSIDE)
{
new_seg.location = CurveSegment::OUTSIDE;
}
@@ -1821,6 +1859,7 @@
return out;
}
+
void
set_append_segment(
std::multiset<CurveSegment> &out,
@@ -1844,12 +1883,13 @@
out.insert(seg);
}
+
void
set_append_segments_at_location(
- std::multiset<CurveSegment> &out,
- std::multiset<CurveSegment> &in,
- CurveSegment::Location location,
- bool reversed_segs_cancel)
+ std::multiset<CurveSegment> &out,
+ std::multiset<CurveSegment> &in,
+ CurveSegment::Location location,
+ bool reversed_segs_cancel)
{
std::multiset<CurveSegment>::iterator i;
if (reversed_segs_cancel) {
@@ -1867,6 +1907,7 @@
}
}
+
std::multiset<CurveSegment>
find_similar_segments(
std::multiset<CurveSegment> &set,
@@ -1885,28 +1926,29 @@
return out;
}
+
HIDDEN std::multiset<CurveSegment>
get_op_segments(
- std::multiset<CurveSegment> &curve1_segments,
- std::multiset<CurveSegment> &curve2_segments,
- op_type op)
+ std::multiset<CurveSegment> &curve1_segments,
+ std::multiset<CurveSegment> &curve2_segments,
+ op_type op)
{
std::multiset<CurveSegment> out;
std::multiset<CurveSegment> c1_boundary_segs;
set_append_segments_at_location(c1_boundary_segs, curve1_segments,
- CurveSegment::BOUNDARY, false);
+ CurveSegment::BOUNDARY, false);
std::multiset<CurveSegment> c2_boundary_segs;
set_append_segments_at_location(c2_boundary_segs, curve2_segments,
- CurveSegment::BOUNDARY, false);
+ CurveSegment::BOUNDARY, false);
if (op == BOOLEAN_INTERSECT) {
set_append_segments_at_location(out, curve1_segments,
- CurveSegment::INSIDE, true);
+ CurveSegment::INSIDE, true);
set_append_segments_at_location(out, curve2_segments,
- CurveSegment::INSIDE, true);
+ CurveSegment::INSIDE, true);
std::multiset<CurveSegment>::iterator i;
for (i = c1_boundary_segs.begin(); i != c1_boundary_segs.end(); ++i) {
@@ -1925,10 +1967,10 @@
}
} else if (op == BOOLEAN_DIFF) {
set_append_segments_at_location(out, curve1_segments,
- CurveSegment::OUTSIDE, true);
+ CurveSegment::OUTSIDE, true);
set_append_segments_at_location(out, curve2_segments,
- CurveSegment::INSIDE, true);
+ CurveSegment::INSIDE, true);
std::multiset<CurveSegment>::iterator i;
for (i = c1_boundary_segs.begin(); i != c1_boundary_segs.end(); ++i) {
@@ -1949,10 +1991,10 @@
}
} else if (op == BOOLEAN_UNION) {
set_append_segments_at_location(out, curve1_segments,
- CurveSegment::OUTSIDE, true);
+ CurveSegment::OUTSIDE, true);
set_append_segments_at_location(out, curve2_segments,
- CurveSegment::OUTSIDE, true);
+ CurveSegment::OUTSIDE, true);
std::multiset<CurveSegment>::iterator i;
for (i = c1_boundary_segs.begin(); i != c1_boundary_segs.end(); ++i) {
@@ -1982,6 +2024,7 @@
return out;
}
+
std::list<ON_SimpleArray<ON_Curve *> >
construct_loops_from_segments(
std::multiset<CurveSegment> &segments)
@@ -2054,6 +2097,7 @@
return out;
}
+
std::multiset<CurvePoint>
get_loop_points(
int source_loop,
@@ -2064,17 +2108,18 @@
ON_Curve *loop1_seg = loop1[0];
out.insert(CurvePoint(source_loop, 0, loop1_seg->Domain().m_t[0],
loop1_seg,
- loop2));
+ loop2));
for (int i = 0; i < loop1.Count(); ++i) {
loop1_seg = loop1[i];
out.insert(CurvePoint(source_loop, i, loop1_seg->Domain().m_t[1],
- loop1_seg, loop2));
+ loop1_seg, loop2));
}
return out;
}
+
// separate outerloops and innerloops
HIDDEN LoopBooleanResult
make_result_from_loops(const std::list<ON_SimpleArray<ON_Curve *> > &loops)
@@ -2167,21 +2212,21 @@
for (int k = 0; k < x_events.Count(); ++k) {
add_point_to_set(loop1_points, CurvePoint(1, i,
- x_events[k].m_a[0], x_events[k].m_A[0],
- CurvePoint::BOUNDARY));
+ x_events[k].m_a[0],
x_events[k].m_A[0],
+
CurvePoint::BOUNDARY));
add_point_to_set(loop2_points, CurvePoint(2, j,
- x_events[k].m_b[0], x_events[k].m_B[0],
- CurvePoint::BOUNDARY));
+ x_events[k].m_b[0],
x_events[k].m_B[0],
+
CurvePoint::BOUNDARY));
if (x_events[k].m_type == ON_X_EVENT::ccx_overlap) {
add_point_to_set(loop1_points, CurvePoint(1, i,
- x_events[k].m_a[1], x_events[k].m_A[1],
- CurvePoint::BOUNDARY));
+
x_events[k].m_a[1], x_events[k].m_A[1],
+
CurvePoint::BOUNDARY));
add_point_to_set(loop2_points, CurvePoint(2, j,
- x_events[k].m_b[1], x_events[k].m_B[1],
- CurvePoint::BOUNDARY));
+
x_events[k].m_b[1], x_events[k].m_B[1],
+
CurvePoint::BOUNDARY));
}
}
}
@@ -2216,6 +2261,7 @@
return out;
}
+
std::list<ON_SimpleArray<ON_Curve *> >
innerloops_inside_outerloop(
const ON_SimpleArray<ON_Curve *> &outerloop_curve,
@@ -2227,7 +2273,7 @@
std::list<ON_SimpleArray<ON_Curve *> > new_innerloops;
LoopBooleanResult new_loops;
new_loops = loop_boolean(outerloop_curve, innerloop_curves[i],
- BOOLEAN_INTERSECT);
+ BOOLEAN_INTERSECT);
// grab outerloops
for (size_t j = 0; j < new_loops.outerloops.size(); ++j) {
@@ -2239,11 +2285,12 @@
return out;
}
+
TrimmedFace *
make_face_from_loops(
- const TrimmedFace *orig_face,
- const ON_SimpleArray<ON_Curve *> &outerloop,
- const std::vector<ON_SimpleArray<ON_Curve *> > &innerloops)
+ const TrimmedFace *orig_face,
+ const ON_SimpleArray<ON_Curve *> &outerloop,
+ const std::vector<ON_SimpleArray<ON_Curve *> > &innerloops)
{
TrimmedFace *face = new TrimmedFace();
@@ -2263,6 +2310,7 @@
return face;
}
+
HIDDEN LoopBooleanResult
combine_loops(
const TrimmedFace *orig_face,
@@ -2288,7 +2336,7 @@
for (size_t i = 0; i < orig_face->m_innerloop.size(); ++i) {
LoopBooleanResult merged = loop_boolean(candidate_innerloop,
- orig_face->m_innerloop[i], BOOLEAN_UNION);
+ orig_face->m_innerloop[i],
BOOLEAN_UNION);
if (merged.outerloops.size() == 1) {
candidate_innerloop = merged.outerloops[0];
@@ -2331,7 +2379,7 @@
part = outerloop_parts.begin();
for (; part != outerloop_parts.end(); part = next_part) {
LoopBooleanResult diffed = loop_boolean(*part,
- merged_innerloops[j], BOOLEAN_DIFF);
+ merged_innerloops[j],
BOOLEAN_DIFF);
next_part = part;
++next_part;
@@ -2381,20 +2429,21 @@
HIDDEN void
append_faces_from_loops(
- ON_SimpleArray<TrimmedFace *> &out,
- const TrimmedFace *orig_face,
- const LoopBooleanResult &new_loops)
+ ON_SimpleArray<TrimmedFace *> &out,
+ const TrimmedFace *orig_face,
+ const LoopBooleanResult &new_loops)
{
LoopBooleanResult combined_loops = combine_loops(orig_face, new_loops);
// make a face from each outerloop, using appropriate innerloops
for (size_t i = 0; i < combined_loops.outerloops.size(); ++i) {
out.Append(make_face_from_loops(orig_face,
- combined_loops.outerloops[i],
- combined_loops.innerloops));
+ combined_loops.outerloops[i],
+ combined_loops.innerloops));
}
}
+
/* Turn an open curve into a closed curve by using segments from the
* face outerloop to connect its endpoints.
*
@@ -2430,7 +2479,7 @@
for (int i = 0; i < orig_face->m_outerloop.Count(); i++) {
ON_SimpleArray<ON_X_EVENT> x_events;
ON_Intersect(orig_face->m_outerloop[i], linked_curve.Curve(),
- x_events, INTERSECTION_TOL);
+ x_events, INTERSECTION_TOL);
for (int j = 0; j < x_events.Count(); j++) {
IntersectPoint tmp_pt;
@@ -2721,6 +2770,7 @@
return out;
}
+
void
free_loops(std::vector<ON_SimpleArray<ON_Curve *> > &loops)
{
@@ -2732,6 +2782,7 @@
}
}
+
bool
loop_is_degenerate(const ON_SimpleArray<ON_Curve *> &loop)
{
@@ -2749,6 +2800,7 @@
return pt1.DistanceTo(pt2) < INTERSECTION_TOL;
}
+
// It might be worth investigating the following approach to building a set of
faces from the splitting
// in order to achieve robustness in the final result:
//
@@ -2833,7 +2885,7 @@
// get the portion of the face outerloop inside the
// ssx loop
intersect_loops = loop_boolean(out[k]->m_outerloop,
- ssx_loops[j], BOOLEAN_INTERSECT);
+ ssx_loops[j], BOOLEAN_INTERSECT);
if (ssx_curves[i].IsClosed()) {
if (intersect_loops.outerloops.empty()) {
@@ -2845,7 +2897,7 @@
// for a naturally closed ssx curve, we also need
// the portion outside the loop
diff_loops = loop_boolean(out[k]->m_outerloop, ssx_loops[j],
- BOOLEAN_DIFF);
+ BOOLEAN_DIFF);
append_faces_from_loops(next_out, out[k], diff_loops);
diff_loops.ClearInnerloops();
@@ -2920,22 +2972,22 @@
return false;
}
/*
- // Deal with two planes, if that's what we have - in that case
- // the determination can be more general than the CV comparison
- ON_Plane surf1_plane, surf2_plane;
- if (surf1->IsPlanar(&surf1_plane) && surf2->IsPlanar(&surf2_plane)) {
- ON_3dVector surf1_normal = surf1_plane.Normal();
- ON_3dVector surf2_normal = surf2_plane.Normal();
- if (surf1_normal.IsParallelTo(surf2_normal) == 1) {
- if (surf1_plane.DistanceTo(surf2_plane.Origin()) <
ON_ZERO_TOLERANCE) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
+ // Deal with two planes, if that's what we have - in that case
+ // the determination can be more general than the CV comparison
+ ON_Plane surf1_plane, surf2_plane;
+ if (surf1->IsPlanar(&surf1_plane) && surf2->IsPlanar(&surf2_plane)) {
+ ON_3dVector surf1_normal = surf1_plane.Normal();
+ ON_3dVector surf2_normal = surf2_plane.Normal();
+ if (surf1_normal.IsParallelTo(surf2_normal) == 1) {
+ if (surf1_plane.DistanceTo(surf2_plane.Origin()) < ON_ZERO_TOLERANCE) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
*/
ON_NurbsSurface nurbs_surf1, nurbs_surf2;
@@ -3164,6 +3216,7 @@
}
}
+
HIDDEN bool
is_point_on_brep_surface(const ON_3dPoint &pt, const ON_Brep *brep,
ON_SimpleArray<Subsurface *> &surf_tree)
{
@@ -3298,6 +3351,7 @@
return pt_no_dup.Count() % 2 != 0;
}
+
HIDDEN bool
is_point_inside_trimmed_face(const ON_2dPoint &pt, const TrimmedFace *tface)
{
@@ -3314,6 +3368,7 @@
return inside;
}
+
// TODO: For faces that have most of their area trimmed away, this is
// a very inefficient algorithm. If the grid approach doesn't work
// after a small number of samples, we should switch to an alternative
@@ -3352,12 +3407,14 @@
return test_pt2d;
}
+
enum {
OUTSIDE_BREP,
INSIDE_BREP,
ON_BREP_SURFACE
};
+
// Returns the location of the face with respect to the brep.
//
// Throws InvalidGeometry if given invalid arguments.
@@ -3407,13 +3464,14 @@
return is_point_inside_brep(test_pt3d, brep, surf_tree) ? INSIDE_BREP :
OUTSIDE_BREP;
}
+
HIDDEN ON_ClassArray<ON_SimpleArray<SSICurve> >
get_face_intersection_curves(
- ON_SimpleArray<Subsurface *> &surf_tree1,
- ON_SimpleArray<Subsurface *> &surf_tree2,
- const ON_Brep *brep1,
- const ON_Brep *brep2,
- op_type operation)
+ ON_SimpleArray<Subsurface *> &surf_tree1,
+ ON_SimpleArray<Subsurface *> &surf_tree2,
+ const ON_Brep *brep1,
+ const ON_Brep *brep2,
+ op_type operation)
{
std::set<int> unused1, unused2;
std::set<int> finalform1, finalform2;
@@ -3432,23 +3490,23 @@
int curr_index = i < face_count1 ? i : i - face_count1;
if (face.BoundingBox().MinimumDistanceTo(brep->BoundingBox()) >
ON_ZERO_TOLERANCE) {
switch (operation) {
- case BOOLEAN_UNION:
- intact->insert(curr_index);
- break;
- case BOOLEAN_DIFF:
- if (i < face_count1) {
+ case BOOLEAN_UNION:
intact->insert(curr_index);
- }
- if (i >= face_count1) {
+ break;
+ case BOOLEAN_DIFF:
+ if (i < face_count1) {
+ intact->insert(curr_index);
+ }
+ if (i >= face_count1) {
+ unused->insert(curr_index);
+ }
+ break;
+ case BOOLEAN_INTERSECT:
unused->insert(curr_index);
- }
- break;
- case BOOLEAN_INTERSECT:
- unused->insert(curr_index);
- break;
- default:
- throw InvalidBooleanOperation("Error - unknown "
- "boolean operation\n");
+ break;
+ default:
+ throw InvalidBooleanOperation("Error - unknown "
+ "boolean operation\n");
}
}
}
@@ -3499,7 +3557,7 @@
if (DEBUG_BREP_BOOLEAN) {
bu_log("Summary of brep status: \n unused1: %zd\n unused2: %zd\n
finalform1: %zd\n finalform2 %zd\nintersection_candidates(%zd):\n",
unused1.size(), unused2.size(), finalform1.size(), finalform2.size(),
intersection_candidates.size());
for (std::set<std::pair<int, int> >::iterator it =
intersection_candidates.begin(); it != intersection_candidates.end(); ++it) {
- bu_log(" (%d,%d)\n", (*it).first, (*it).second);
+ bu_log(" (%d, %d)\n", (*it).first, (*it).second);
}
}
@@ -3557,7 +3615,7 @@
ON_SimpleArray<ON_Curve *> subcurves_on1, subcurves_on2;
get_subcurves_inside_faces(subcurves_on1,
- subcurves_on2, brep1, brep2, i, j, &events[k]);
+ subcurves_on2, brep1, brep2,
i, j, &events[k]);
for (int l = 0; l < subcurves_on1.Count(); ++l) {
SSICurve ssi_on1;
@@ -3595,6 +3653,7 @@
return curves_array;
}
+
HIDDEN ON_SimpleArray<ON_Curve *>get_face_trim_loop(const ON_Brep *brep, int
face_loop_index)
{
const ON_BrepLoop &loop = brep->m_L[face_loop_index];
@@ -3607,6 +3666,7 @@
return face_trim_loop;
}
+
HIDDEN ON_SimpleArray<TrimmedFace *>
get_trimmed_faces(const ON_Brep *brep)
{
@@ -3632,14 +3692,15 @@
return trimmed_faces;
}
+
HIDDEN void
categorize_trimmed_faces(
- ON_ClassArray<ON_SimpleArray<TrimmedFace *> > &trimmed_faces,
- const ON_Brep *brep1,
- const ON_Brep *brep2,
- ON_SimpleArray<Subsurface *> &surf_tree1,
- ON_SimpleArray<Subsurface *> &surf_tree2,
- op_type operation)
+ ON_ClassArray<ON_SimpleArray<TrimmedFace *> > &trimmed_faces,
+ const ON_Brep *brep1,
+ const ON_Brep *brep2,
+ ON_SimpleArray<Subsurface *> &surf_tree1,
+ ON_SimpleArray<Subsurface *> &surf_tree2,
+ op_type operation)
{
int face_count1 = brep1->m_F.Count();
for (int i = 0; i < trimmed_faces.Count(); i++) {
@@ -3711,7 +3772,7 @@
ON_ClassArray<ON_PX_EVENT> px_event;
if (ON_Intersect(face_pt3d, *brep_surf, px_event,
- INTERSECTION_TOL, 0, 0,
surf_tree[face.m_si]))
+ INTERSECTION_TOL, 0, 0,
surf_tree[face.m_si]))
{
found = true;
brep_pt2d = px_event[0].m_b;
@@ -3742,13 +3803,14 @@
}
if (DEBUG_BREP_BOOLEAN) {
bu_log("The trimmed face is %s the other brep.",
- (face_location == INSIDE_BREP) ? "inside" :
- ((face_location == OUTSIDE_BREP) ? "outside" : "on the
surface of"));
+ (face_location == INSIDE_BREP) ? "inside" :
+ ((face_location == OUTSIDE_BREP) ? "outside" : "on the
surface of"));
}
}
}
}
+
HIDDEN ON_ClassArray<ON_SimpleArray<TrimmedFace *> >
get_evaluated_faces(const ON_Brep *brep1, const ON_Brep *brep2, op_type
operation)
{
@@ -3818,6 +3880,7 @@
return trimmed_faces;
}
+
HIDDEN void
standardize_loop_orientations(ON_Brep *brep)
{
@@ -3873,7 +3936,7 @@
ON_Curve *curve_copy =
trim->EdgeCurveOf()->DuplicateCurve();
int copy_c3i = brep->AddEdgeCurve(curve_copy);
ON_BrepEdge &edge_copy = brep->NewEdge(v_start,
- v_end, copy_c3i, &dom, edge->m_tolerance);
+ v_end, copy_c3i,
&dom, edge->m_tolerance);
reversed_edge[trim->m_ei] = copy_c3i;
@@ -3890,6 +3953,7 @@
}
}
+
int
ON_Boolean(ON_Brep *evaluated_brep, const ON_Brep *brep1, const ON_Brep
*brep2, op_type operation)
{
@@ -3898,18 +3962,18 @@
/* Deal with the trivial cases up front */
if (brep1->BoundingBox().MinimumDistanceTo(brep2->BoundingBox()) >
ON_ZERO_TOLERANCE) {
switch (operation) {
- case BOOLEAN_UNION:
- evaluated_brep->Append(*brep1);
- evaluated_brep->Append(*brep2);
- break;
- case BOOLEAN_DIFF:
- evaluated_brep->Append(*brep1);
- break;
- case BOOLEAN_INTERSECT:
- return 0;
- break;
- default:
- throw InvalidBooleanOperation("Error - unknown boolean
operation\n");
+ case BOOLEAN_UNION:
+ evaluated_brep->Append(*brep1);
+ evaluated_brep->Append(*brep2);
+ break;
+ case BOOLEAN_DIFF:
+ evaluated_brep->Append(*brep1);
+ break;
+ case BOOLEAN_INTERSECT:
+ return 0;
+ break;
+ default:
+ throw InvalidBooleanOperation("Error - unknown boolean
operation\n");
}
evaluated_brep->ShrinkSurfaces();
evaluated_brep->Compact();
Modified: brlcad/trunk/src/libbrep/brep_except.h
===================================================================
--- brlcad/trunk/src/libbrep/brep_except.h 2016-09-30 04:06:48 UTC (rev
68939)
+++ brlcad/trunk/src/libbrep/brep_except.h 2016-09-30 04:15:54 UTC (rev
68940)
@@ -28,39 +28,45 @@
class InvalidBooleanOperation : public std::invalid_argument
{
public:
- InvalidBooleanOperation(const std::string &msg = "") :
std::invalid_argument(msg) {}
+InvalidBooleanOperation(const std::string &msg = "") :
std::invalid_argument(msg) {}
};
+
class InvalidGeometry : public std::invalid_argument
{
public:
- InvalidGeometry(const std::string &msg = "") : std::invalid_argument(msg)
{}
+InvalidGeometry(const std::string &msg = "") : std::invalid_argument(msg) {}
};
+
class AlgorithmError : public std::runtime_error
{
public:
- AlgorithmError(const std::string &msg = "") : std::runtime_error(msg) {}
+AlgorithmError(const std::string &msg = "") : std::runtime_error(msg) {}
};
+
class GeometryGenerationError : public std::runtime_error
{
public:
- GeometryGenerationError(const std::string &msg = "") :
std::runtime_error(msg) {}
+GeometryGenerationError(const std::string &msg = "") : std::runtime_error(msg)
{}
};
+
class IntervalGenerationError : public std::runtime_error
{
public:
- IntervalGenerationError(const std::string &msg = "") :
std::runtime_error(msg) {}
+IntervalGenerationError(const std::string &msg = "") : std::runtime_error(msg)
{}
};
+
class InvalidInterval : public std::runtime_error
{
public:
- InvalidInterval(const std::string &msg = "") : std::runtime_error(msg) {}
+InvalidInterval(const std::string &msg = "") : std::runtime_error(msg) {}
};
+
#endif
/*
Modified: brlcad/trunk/src/libbrep/libbrep_brep_tools.cpp
===================================================================
--- brlcad/trunk/src/libbrep/libbrep_brep_tools.cpp 2016-09-30 04:06:48 UTC
(rev 68939)
+++ brlcad/trunk/src/libbrep/libbrep_brep_tools.cpp 2016-09-30 04:15:54 UTC
(rev 68940)
@@ -39,6 +39,7 @@
return (val > -epsilon) && (val < epsilon);
}
+
double ON_Curve_Get_Tangent(int direction, const ON_Curve* curve, double min,
double max, double zero_tol) {
double mid;
bool tanmin;
@@ -68,14 +69,17 @@
return min;
}
+
double ON_Curve_Get_Horizontal_Tangent(const ON_Curve* curve, double min,
double max, double zero_tol) {
return ON_Curve_Get_Tangent(1, curve, min, max, zero_tol);
}
+
double ON_Curve_Get_Vertical_Tangent(const ON_Curve* curve, double min, double
max, double zero_tol) {
return ON_Curve_Get_Tangent(0, curve, min, max, zero_tol);
}
+
int ON_Curve_Has_Tangent(const ON_Curve* curve, double ct_min, double ct_max,
double t_tol) {
bool tanx1, tanx2, x_changed;
@@ -118,6 +122,7 @@
return 0;
}
+
HIDDEN double
find_next_point(const ON_Curve* crv, double startdomval, double increment,
double tolerance, int stepcount)
{
@@ -136,6 +141,7 @@
}
}
+
int ON_Curve_PolyLine_Approx(ON_Polyline *polyline, const ON_Curve *curve,
double tol)
{
ON_3dPointArray pnts;
@@ -193,7 +199,7 @@
double Ndot=1.0;
for (int i=0; i<8; i++) {
- for ( int j=i+1; j<9; j++) {
+ for (int j=i+1; j<9; j++) {
if ((Ndot = Ndot * frames[i].zaxis * frames[j].zaxis) < f_tol) {
return false;
}
@@ -203,6 +209,7 @@
return true;
}
+
bool ON_Surface_IsFlat_U(const ON_Plane frames[9], double f_tol)
{
// check surface normals in U direction
@@ -232,6 +239,7 @@
return true;
}
+
bool ON_Surface_IsFlat_V(const ON_Plane frames[9], double f_tol)
{
// check surface normals in V direction
@@ -261,12 +269,13 @@
return true;
}
+
bool ON_Surface_IsStraight(const ON_Plane frames[9], double s_tol)
{
double Xdot=1.0;
for (int i=0; i<8; i++) {
- for ( int j=i+1; j<9; j++) {
+ for (int j=i+1; j<9; j++) {
if ((Xdot = Xdot * frames[0].xaxis * frames[1].xaxis) < s_tol) {
return false;
}
Modified: brlcad/trunk/src/libbrep/opennurbs_ext.cpp
===================================================================
--- brlcad/trunk/src/libbrep/opennurbs_ext.cpp 2016-09-30 04:06:48 UTC (rev
68939)
+++ brlcad/trunk/src/libbrep/opennurbs_ext.cpp 2016-09-30 04:15:54 UTC (rev
68940)
@@ -668,7 +668,7 @@
max[i] += within_distance_tol;
#endif
if ((min != ON_3dPoint::UnsetPoint) && (max != ON_3dPoint::UnsetPoint))
{
- dom[i].Set(min[i],max[i]);
+ dom[i].Set(min[i], max[i]);
}
}
ON_Interval u = dom[0];
@@ -821,7 +821,7 @@
new_uv[1] = node->m_v[1];
- surface_EvNormal(surf,new_uv[0], new_uv[1], newpt, ray.m_dir);
+ surface_EvNormal(surf, new_uv[0], new_uv[1], newpt, ray.m_dir);
ray.m_dir.Reverse();
brep_get_plane_ray(ray, pr);
@@ -900,18 +900,18 @@
//static int bb_cnt=0;
BBNode *
SurfaceTree::surfaceBBox(const ON_Surface *localsurf,
- bool isLeaf,
- const ON_Plane frames[9],
- const ON_Interval& u,
- const ON_Interval& v,
- double within_distance_tol) const
+ bool isLeaf,
+ const ON_Plane frames[9],
+ const ON_Interval& u,
+ const ON_Interval& v,
+ double within_distance_tol) const
{
point_t min, max, buffer;
#ifdef _OLD_SUBDIVISION_
ON_BoundingBox bbox = localsurf->BoundingBox();
#else
ON_BoundingBox bbox = ON_BoundingBox::EmptyBoundingBox;
- if (!surface_GetBoundingBox(localsurf,u,v,bbox,false)) {
+ if (!surface_GetBoundingBox(localsurf, u, v, bbox, false)) {
return NULL;
}
#endif
@@ -967,14 +967,14 @@
ON_BoundingBox bb = surf->BoundingBox();
#else
ON_BoundingBox bb = ON_BoundingBox::EmptyBoundingBox;
- if (!surface_GetBoundingBox(surf,u,v,bb,false)) {
+ if (!surface_GetBoundingBox(surf, u, v, bb, false)) {
return NULL;
}
#endif
BBNode* node = new BBNode(ctree, bb, u, v, false, false);
ON_3dPoint estimate;
ON_3dVector normal;
- if (!surface_EvNormal(surf,surf->Domain(0).Mid(), surf->Domain(1).Mid(),
estimate, normal)) {
+ if (!surface_EvNormal(surf, surf->Domain(0).Mid(), surf->Domain(1).Mid(),
estimate, normal)) {
bu_bomb("Could not evaluate estimate point on surface");
}
node->m_estimate = estimate;
@@ -1007,7 +1007,7 @@
return false;
}
- if (prev_surf[p] != surf ) {
+ if (prev_surf[p] != surf) {
// load new surf info
for(int i=0; i<2; i++) {
dom[p][i] = surf->Domain(i);
@@ -1135,11 +1135,11 @@
}
#else
int dir = 0; // U direction
- if (hasSplit(localsurf,dir,u,usplit)) {
+ if (hasSplit(localsurf, dir, u, usplit)) {
do_u_split = 1;
}
dir = 1; // V direction
- if (hasSplit(localsurf,dir,v,vsplit)) {
+ if (hasSplit(localsurf, dir, v, vsplit)) {
if (do_u_split) {
do_both_splits = 1;
do_u_split = 0;
Modified: brlcad/trunk/src/libbrep/px_event.cpp
===================================================================
--- brlcad/trunk/src/libbrep/px_event.cpp 2016-09-30 04:06:48 UTC (rev
68939)
+++ brlcad/trunk/src/libbrep/px_event.cpp 2016-09-30 04:15:54 UTC (rev
68940)
@@ -28,9 +28,10 @@
ON_PX_EVENT::ON_PX_EVENT()
{
- memset(this,0,sizeof(*this));
+ memset(this, 0, sizeof(*this));
}
+
int
ON_PX_EVENT::Compare(const ON_PX_EVENT* a, const ON_PX_EVENT* b)
{
@@ -44,6 +45,7 @@
return a->m_Mid < b->m_Mid;
}
+
bool
ON_PX_EVENT::IsValid(ON_TextLog*,
double,
@@ -59,6 +61,7 @@
return true;
}
+
void
ON_PX_EVENT::Dump(ON_TextLog& text_log) const
{
@@ -130,6 +133,7 @@
text_log.PopIndent();
}
+
// Local Variables:
// tab-width: 8
// mode: C++
Modified: brlcad/trunk/src/libbrep/shape_recognition.cpp
===================================================================
--- brlcad/trunk/src/libbrep/shape_recognition.cpp 2016-09-30 04:06:48 UTC
(rev 68939)
+++ brlcad/trunk/src/libbrep/shape_recognition.cpp 2016-09-30 04:15:54 UTC
(rev 68940)
@@ -81,6 +81,7 @@
return loops_planar;
}
+
int
bbox_isect(struct subbrep_island_data *s, struct subbrep_island_data *c)
{
@@ -100,6 +101,7 @@
}
}
+
/*
* This is the point at which we characterize the relationships between
* islands. Assuming our determination of positive and negative shapes is
@@ -194,7 +196,6 @@
}
-
int
shoal_filter_loop(int control_loop, int candidate_loop, struct
subbrep_island_data *data)
{
@@ -227,6 +228,7 @@
return 1;
}
+
int
shoal_build(int **s_loops, int loop_index, struct subbrep_island_data *data)
{
@@ -269,7 +271,6 @@
}
-
/* In order to represent complex shapes, it is necessary to identify
* subsets of subbreps that can be represented as primitives. This
* function will identify such subsets, if possible. If a subbrep
@@ -367,6 +368,7 @@
return 1;
}
+
struct bu_ptbl *
brep_to_csg(struct bu_vls *msgs, const ON_Brep *brep)
{
@@ -543,7 +545,7 @@
bail:
// Free memory
- for (unsigned int i = 0; i < BU_PTBL_LEN(subbreps); i++){
+ for (unsigned int i = 0; i < BU_PTBL_LEN(subbreps); i++) {
struct subbrep_island_data *obj = (struct subbrep_island_data
*)BU_PTBL_GET(subbreps, i);
subbrep_island_free(obj);
BU_PUT(obj, struct subbrep_island_data);
@@ -554,7 +556,6 @@
}
-
// Local Variables:
// tab-width: 8
// mode: C++
Modified: brlcad/trunk/src/libbrep/shape_recognition.h
===================================================================
--- brlcad/trunk/src/libbrep/shape_recognition.h 2016-09-30 04:06:48 UTC
(rev 68939)
+++ brlcad/trunk/src/libbrep/shape_recognition.h 2016-09-30 04:15:54 UTC
(rev 68940)
@@ -16,22 +16,23 @@
#define BREP_ELLIPSOIDAL_TOL 0.05
#define BREP_TOROIDAL_TOL 0.05
-#define pout(p) p.x << " " << p.y << " " << p.z
+#define pout(p) p.x << " " << p.y << " " << p.z
void set_to_array(int **array, int *array_cnt, std::set<int> *set);
void array_to_set(std::set<int> *set, int *array, int array_cnt);
#define ON_VMOVE(on, bn) { \
- on.x = bn[0]; \
- on.y = bn[1]; \
- on.z = bn[2]; \
-}
+ on.x = bn[0]; \
+ on.y = bn[1]; \
+ on.z = bn[2]; \
+ }
#define BN_VMOVE(bn, on) { \
- bn[0] = on.x; \
- bn[1] = on.y; \
- bn[2] = on.z; \
-}
+ bn[0] = on.x; \
+ bn[1] = on.y; \
+ bn[2] = on.z; \
+ }
+
typedef enum {
SURFACE_PLANE = 0,
SURFACE_CYLINDRICAL_SECTION,
@@ -107,8 +108,6 @@
int sph_implicit_params(struct subbrep_shoal_data *data,
ON_SimpleArray<ON_Plane> *sph_planes, int shoal_nonplanar_face);
-
-
#endif /* SHAPE_RECOGNITION_H */
// Local Variables:
Modified: brlcad/trunk/src/libbrep/shape_recognition_cone.cpp
===================================================================
--- brlcad/trunk/src/libbrep/shape_recognition_cone.cpp 2016-09-30 04:06:48 UTC
(rev 68939)
+++ brlcad/trunk/src/libbrep/shape_recognition_cone.cpp 2016-09-30 04:15:54 UTC
(rev 68940)
@@ -47,7 +47,6 @@
}
-
/* Return -1 if the cone face is pointing in toward the axis,
* 1 if it is pointing out, and 0 if there is some other problem */
int
@@ -262,7 +261,6 @@
}
-
return need_arbn;
}
Modified: brlcad/trunk/src/libbrep/shape_recognition_pipeline.cpp
===================================================================
--- brlcad/trunk/src/libbrep/shape_recognition_pipeline.cpp 2016-09-30
04:06:48 UTC (rev 68939)
+++ brlcad/trunk/src/libbrep/shape_recognition_pipeline.cpp 2016-09-30
04:15:54 UTC (rev 68940)
@@ -100,7 +100,7 @@
// Now, any non-linear edge that isn't degenerate should be supplying a
// plane. (We don't currently handle non-planar edges like those from a
- // sphere subtracted from a cylinder.) Liner curves are saved - they need
+ // sphere subtracted from a cylinder.) Liner curves are saved - they need
// special interpretation for cylinders and cones (spheres shouldn't have
// any.)
ON_SimpleArray<ON_Plane> non_linear_edge_planes;
@@ -298,7 +298,6 @@
if (need_arbn == -1) return 0;
-
if (!need_arbn) {
//bu_log("Perfect implicit found in %s\n", bu_vls_addr(data->i->key));
return 1;
@@ -356,7 +355,7 @@
sub_param->plane_cnt = arbn_planes.Count();
for (int i = 0; i < arbn_planes.Count(); i++) {
ON_Plane p = arbn_planes[i];
- double d = p.DistanceTo(ON_3dPoint(0,0,0));
+ double d = p.DistanceTo(ON_3dPoint(0, 0, 0));
sub_param->planes[i][0] = p.Normal().x;
sub_param->planes[i][1] = p.Normal().y;
sub_param->planes[i][2] = p.Normal().z;
Modified: brlcad/trunk/src/libbrep/shape_recognition_planar.cpp
===================================================================
--- brlcad/trunk/src/libbrep/shape_recognition_planar.cpp 2016-09-30
04:06:48 UTC (rev 68939)
+++ brlcad/trunk/src/libbrep/shape_recognition_planar.cpp 2016-09-30
04:15:54 UTC (rev 68940)
@@ -113,6 +113,7 @@
return num_faces;
}
+
// This shouldn't actually be needed if we don't have self intersecting
islands...
int
triangulate_array_with_holes(ON_2dPointArray &on2dpts, int *verts_map, int
loop_cnt, int *loop_starts, int **ffaces, const ON_Brep *UNUSED(brep))
@@ -219,7 +220,6 @@
}
-
/* TODO -rename to planar_polygon_tri */
int
subbrep_polygon_tri(struct bu_vls *UNUSED(msgs), struct subbrep_island_data
*data, int *loops, int loop_cnt, int *rev_status, int **ffaces)
@@ -331,6 +331,7 @@
return num_faces;
}
+
// A shoal, unlike a planar face, may define it's bounding planar loop using
// data from multiple face loops. For this situation we walk the edges, and if
// we hit a null vertex we need to use that vertex to find the next edge that
@@ -464,8 +465,8 @@
ON_3dVector v3d = v->Point() - p.Origin();
double xcoord = ON_DotProduct(v3d, xaxis);
double ycoord = ON_DotProduct(v3d, yaxis);
- on2dpts.Append(ON_2dPoint(xcoord,ycoord));
- //bu_log("x,y: %f,%f\n", xcoord, ycoord);
+ on2dpts.Append(ON_2dPoint(xcoord, ycoord));
+ //bu_log("x, y: %f, %f\n", xcoord, ycoord);
}
if (polygon_verts.empty()) return 0;
@@ -481,14 +482,15 @@
return num_faces;
}
+
/*
* To determine if a polyhedron is inside or outside, we do a ray-based
* test. We will assume that determining the positive/negative status of one
* face is sufficient - i.e., we will not check for flipped normals on faces.
*
- 1. Construct a ray with a point outside the bounding box and
+ 1. Construct a ray with a point outside the bounding box and
* a point on one of the faces (try to make sure the face normal is not
- * close to perpendicular relative to the constructed ray.) Intersect this
+ * close to perpendicular relative to the constructed ray.) Intersect this
* ray with all triangles in the BoT (unless BoTs regularly appear that are
* *far* larger than expected here, it's not worth building acceleration
* structures for a one time, one ray conversion process.
@@ -592,6 +594,7 @@
return io_state;
}
+
// Check for a hard-to-spot degenerate nucleus case that can crop up if we
// have an island with one child.
//
@@ -652,6 +655,7 @@
return 0;
}
+
int
island_nucleus(struct bu_vls *msgs, struct subbrep_island_data *data)
{
@@ -660,7 +664,7 @@
int parallel_planes = 0;
int curr_vert = 0;
ON_Plane seed_plane;
- std::map<int,int> vert_map;
+ std::map<int, int> vert_map;
std::vector<int> all_faces;
std::set<int> all_used_verts;
std::set<int>::iterator auv_it;
@@ -706,7 +710,7 @@
const ON_BrepFace *face = &(brep->m_F[(int)*p_it]);
ON_Plane p;
face->SurfaceOf()->IsPlanar(&p, BREP_PLANAR_TOL);
- //bu_log("face(%d): %f,%f,%f %f,%f,%f\n", face->m_face_index,
p.origin.x, p.origin.y, p.origin.z, p.Normal().x, p.Normal().y, p.Normal().z);
+ //bu_log("face(%d): %f, %f, %f %f, %f, %f\n", face->m_face_index,
p.origin.x, p.origin.y, p.origin.z, p.Normal().x, p.Normal().y, p.Normal().z);
// Determine if we have 1 or a set of loops.
for (int i = 0; i < face->LoopCount(); i++) {
@@ -808,7 +812,7 @@
for (auv_it = all_used_verts.begin(); auv_it != all_used_verts.end();
auv_it++) {
ON_3dPoint vp = brep->m_V[(int)(*auv_it)].Point();
BN_VMOVE(data->nucleus->params->csg_verts[curr_vert], vp);
- vert_map.insert(std::pair<int,int>((int)*auv_it, curr_vert));
+ vert_map.insert(std::pair<int, int>((int)*auv_it, curr_vert));
curr_vert++;
}
for (unsigned int i = 0; i < all_faces.size(); i++) {
@@ -890,7 +894,7 @@
data->nucleus->params->planes = (plane_t *)bu_calloc(planes.Count(),
sizeof(plane_t), "planes");
for (int i = 0; i < planes.Count(); i++) {
ON_Plane p = planes[i];
- double d = p.DistanceTo(ON_3dPoint(0,0,0));
+ double d = p.DistanceTo(ON_3dPoint(0, 0, 0));
data->nucleus->params->planes[i][0] = p.Normal().x;
data->nucleus->params->planes[i][1] = p.Normal().y;
data->nucleus->params->planes[i][2] = p.Normal().z;
@@ -984,6 +988,7 @@
return 1;
}
+
// Local Variables:
// tab-width: 8
// mode: C++
Modified: brlcad/trunk/src/libbrep/shape_recognition_sphere.cpp
===================================================================
--- brlcad/trunk/src/libbrep/shape_recognition_sphere.cpp 2016-09-30
04:06:48 UTC (rev 68939)
+++ brlcad/trunk/src/libbrep/shape_recognition_sphere.cpp 2016-09-30
04:15:54 UTC (rev 68940)
@@ -131,6 +131,7 @@
return (*sph_planes).Count() - 1;
}
+
int
sph_implicit_params(struct subbrep_shoal_data *data, ON_SimpleArray<ON_Plane>
*sph_planes, int shoal_nonplanar_face)
{
@@ -153,8 +154,8 @@
data->params->radius = sph.Radius();
if (need_arbn) {
- ON_3dVector xplus = sph.PointAt(0,0) - sph.Center();
- ON_3dVector yplus = sph.PointAt(M_PI/2,0) - sph.Center();
+ ON_3dVector xplus = sph.PointAt(0, 0) - sph.Center();
+ ON_3dVector yplus = sph.PointAt(M_PI/2, 0) - sph.Center();
ON_3dVector zplus = sph.NorthPole() - sph.Center();
ON_3dPoint xmax = sph.Center() + 1.01*xplus;
ON_3dPoint xmin = sph.Center() - 1.01*xplus;
@@ -177,7 +178,6 @@
}
-
// Local Variables:
// tab-width: 8
// mode: C++
Modified: brlcad/trunk/src/libbrep/shape_recognition_torus.cpp
===================================================================
--- brlcad/trunk/src/libbrep/shape_recognition_torus.cpp 2016-09-30
04:06:48 UTC (rev 68939)
+++ brlcad/trunk/src/libbrep/shape_recognition_torus.cpp 2016-09-30
04:15:54 UTC (rev 68940)
@@ -59,6 +59,7 @@
return 1;
}
+
/* Return -1 if the torus normals are defining a negative volume,
* 1 if it is positive, and 0 if there is some other problem */
int
@@ -193,6 +194,7 @@
return -1;
}
+
// Local Variables:
// tab-width: 8
// mode: C++
Modified: brlcad/trunk/src/libbrep/shape_recognition_util.cpp
===================================================================
--- brlcad/trunk/src/libbrep/shape_recognition_util.cpp 2016-09-30 04:06:48 UTC
(rev 68939)
+++ brlcad/trunk/src/libbrep/shape_recognition_util.cpp 2016-09-30 04:15:54 UTC
(rev 68940)
@@ -10,15 +10,19 @@
#include "brep.h"
#include "shape_recognition.h"
+#define COMMA ','
+
+
void
set_key(struct bu_vls *key, int k_cnt, int *k_array)
{
for (int i = 0; i < k_cnt; i++) {
bu_vls_printf(key, "%d", k_array[i]);
- if (i != k_cnt - 1) bu_vls_printf(key, ",");
+ if (i != k_cnt - 1) bu_vls_printf(key, "%c", COMMA);
}
}
+
void
set_to_array(int **array, int *array_cnt, std::set<int> *set)
{
@@ -35,6 +39,7 @@
}
}
+
void
array_to_set(std::set<int> *set, int *array, int array_cnt)
{
@@ -57,13 +62,14 @@
csg->csg_verts = NULL;
}
+
void
csg_object_params_free(struct csg_object_params *csg)
{
if (!csg) return;
if (csg->planes) bu_free(csg->planes, "free planes");
- if (csg->csg_faces) bu_free(csg->csg_faces , "free faces");
- if (csg->csg_verts) bu_free(csg->csg_verts , "free verts");
+ if (csg->csg_faces) bu_free(csg->csg_faces, "free faces");
+ if (csg->csg_verts) bu_free(csg->csg_verts, "free verts");
}
@@ -73,12 +79,13 @@
data->i = i;
BU_GET(data->params, struct csg_object_params);
csg_object_params_init(data->params, data);
- BU_GET(data->shoal_children , struct bu_ptbl);
+ BU_GET(data->shoal_children, struct bu_ptbl);
bu_ptbl_init(data->shoal_children, 8, "sub_params table");
data->shoal_loops = NULL;
data->shoal_loops_cnt = 0;
}
+
void
subbrep_shoal_free(struct subbrep_shoal_data *data)
{
@@ -96,6 +103,7 @@
if (data->shoal_loops) bu_free(data->shoal_loops, "free loop array");
}
+
void
subbrep_island_init(struct subbrep_island_data *obj, const ON_Brep *brep)
{
@@ -132,6 +140,7 @@
obj->null_edges = NULL;
}
+
void
subbrep_island_free(struct subbrep_island_data *obj)
{
@@ -151,7 +160,7 @@
BU_PUT(obj->key, struct bu_vls);
obj->key = NULL;
- for (unsigned int i = 0; i < BU_PTBL_LEN(obj->island_children); i++){
+ for (unsigned int i = 0; i < BU_PTBL_LEN(obj->island_children); i++) {
struct subbrep_shoal_data *cobj = (struct subbrep_shoal_data
*)BU_PTBL_GET(obj->island_children, i);
subbrep_shoal_free(cobj);
BU_PUT(cobj, struct subbrep_shoal_data);
@@ -181,6 +190,7 @@
obj->null_edges = NULL;
}
+
/* Geometry utilities */
void
@@ -194,6 +204,7 @@
max->z = -ON_DBL_MAX;
}
+
#define LN_DOTP_TOL 0.000001
ON_3dPoint
ON_LinePlaneIntersect(ON_Line &line, ON_Plane &plane)
@@ -223,6 +234,7 @@
return result;
}
+
surface_t
GetSurfaceType(const ON_Surface *orig_surface)
{
@@ -323,6 +335,7 @@
return hofo;
}
+
void
subbrep_bbox(struct subbrep_island_data *obj)
{
@@ -480,6 +493,7 @@
return 0;
}
+
int
subbrep_make_brep(struct bu_vls *UNUSED(msgs), struct subbrep_island_data
*data)
{
@@ -565,7 +579,7 @@
// Edge
if (edge_map.find(edge->m_edge_index) == edge_map.end()) {
- ON_BrepEdge& new_edge = nbrep->NewEdge(nbrep->m_V[v0i],
nbrep->m_V[v1i], c3i, NULL ,0);
+ ON_BrepEdge& new_edge = nbrep->NewEdge(nbrep->m_V[v0i],
nbrep->m_V[v1i], c3i, NULL, 0);
edge_map[edge->m_edge_index] = new_edge.m_edge_index;
}
nedge = &(nbrep->m_E[edge_map[edge->m_edge_index]]);
@@ -647,6 +661,7 @@
return 1;
}
+
// Tikz LaTeX output from B-Rep wireframes
int
ON_BrepTikz(ON_String& s, const ON_Brep *brep, const char *c, const char *pre)
@@ -699,7 +714,7 @@
bu_vls_printf(&output, "\\draw[%s] plot [smooth] coordinates
{", bu_vls_addr(&color));
for (int si = 0; si < poly.Count(); si++) {
ON_3dPoint p = poly[si];
- bu_vls_printf(&output, "(%f,%f,%f) ", p.x, p.y, p.z);
+ bu_vls_printf(&output, "(%f, %f, %f) ", p.x, p.y, p.z);
}
bu_vls_printf(&output, "};\n", bu_vls_addr(&color));
}
@@ -716,7 +731,6 @@
}
-
// Local Variables:
// tab-width: 8
// mode: C++
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits