Revision: 55633
http://sourceforge.net/p/brlcad/code/55633
Author: brlcad
Date: 2013-06-02 02:59:13 +0000 (Sun, 02 Jun 2013)
Log Message:
-----------
reminded of some instanity in the C standard that has comments parsed in phase
3 BEFORE the preprocessor (phase 4) so even #if 0 // comments being compiled in
-pedantic mode will cause gcc to issue a warning. it's a silly unhelpful
interpretation by the gcc devs (that a warning needs to be issued in phase 3
just because it's a comment issue even if the comment is in code hidden by the
pre-processor. at least accommodating the silly is simple.
Modified Paths:
--------------
brlcad/trunk/include/brep.h
Modified: brlcad/trunk/include/brep.h
===================================================================
--- brlcad/trunk/include/brep.h 2013-06-02 02:28:58 UTC (rev 55632)
+++ brlcad/trunk/include/brep.h 2013-06-02 02:59:13 UTC (rev 55633)
@@ -413,7 +413,7 @@
template<class BA>
BANode<BA>::~BANode()
{
- // delete the children
+ /* delete the children */
for (size_t i = 0; i < m_children.size(); i++) {
delete m_children[i];
}
@@ -539,7 +539,7 @@
{
point_t bmin, bmax;
BANode<BA>::GetBBox(bmin, bmax);
- if ((bmin[X] <= uv[X]) && (uv[X] <= bmax[X])) { //if check trim and in BBox
+ if ((bmin[X] <= uv[X]) && (uv[X] <= bmax[X])) { /* if check trim and in
BBox */
fastf_t v = getCurveEstimateOfV(uv[X], 0.0000001);
trimdist = v - uv[Y];
if (uv[Y] <= v) {
@@ -590,27 +590,29 @@
BANode<BA>::getClosestPointEstimate(const ON_3dPoint& pt, ON_Interval& u,
ON_Interval& v)
{
if (isLeaf()) {
- double uvs[5][2] = {{m_u.Min(), m_v.Min()}, // include the corners for
an easy refinement
+ 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()}}; // include the estimate
+ {m_u.Mid(), m_v.Mid()}}; /* include the estimate */
ON_3dPoint corners[5];
const ON_Surface* surf = m_face->SurfaceOf();
u = m_u;
v = m_v;
- // ??? should we pass these in from SurfaceTree::curveBBox() to avoid
this recalculation?
+ /* ??? should we pass these in from SurfaceTree::curveBBox()
+ * to avoid this recalculation?
+ */
if (!surf->EvPoint(uvs[0][0], uvs[0][1], corners[0]) ||
!surf->EvPoint(uvs[1][0], uvs[1][1], corners[1]) ||
!surf->EvPoint(uvs[2][0], uvs[2][1], corners[2]) ||
!surf->EvPoint(uvs[3][0], uvs[3][1], corners[3])) {
- throw new std::exception(); // FIXME
+ throw new std::exception(); /* FIXME */
}
corners[4] = BANode<BA>::m_estimate;
- // find the point on the curve closest to pt
+ /* find the point on the curve closest to pt */
size_t mini = 0;
double mindist = pt.DistanceTo(corners[mini]);
double tmpdist;
@@ -669,7 +671,7 @@
}
fastf_t dU = B[X] - A[X];
- if (NEAR_ZERO(dU, tol)) { //vertical
+ if (NEAR_ZERO(dU, tol)) { /* vertical */
return A[Y];
}
@@ -707,7 +709,7 @@
}
dU = B[X] - A[X];
- if (NEAR_ZERO(dU, tol)) { //vertical
+ if (NEAR_ZERO(dU, tol)) { /* vertical */
return A[Y];
}
@@ -724,7 +726,7 @@
VMOVE(B, p);
}
dU = B[X] - A[X];
- if (NEAR_ZERO(dU, tol)) { //vertical
+ if (NEAR_ZERO(dU, tol)) { /* vertical */
return A[Y];
}
@@ -762,7 +764,7 @@
}
fastf_t dV = B[Y] - A[Y];
- if (NEAR_ZERO(dV, tol)) { //horizontal
+ if (NEAR_ZERO(dV, tol)) { /* horizontal */
return A[X];
}
@@ -792,7 +794,7 @@
}
dV = B[Y] - A[Y];
- if (NEAR_ZERO(dV, tol)) { //horizontal
+ if (NEAR_ZERO(dV, tol)) { /* horizontal */
return A[X];
}
@@ -809,7 +811,7 @@
VMOVE(B, p);
}
dV = B[Y] - A[Y];
- if (NEAR_ZERO(dV, tol)) { //horizontal
+ if (NEAR_ZERO(dV, tol)) { /* horizontal */
return A[X];
}
dT = Tb - Ta;
@@ -828,8 +830,9 @@
extern bool sortX(BRNode* first, BRNode* second);
extern bool sortY(BRNode* first, BRNode* second);
-//--------------------------------------------------------------------------------
-// CurveTree declaration
+/*--------------------------------------------------------------------------------
+ * CurveTree declaration
+ */
class BREP_EXPORT CurveTree {
public:
CurveTree(const ON_BrepFace* face);
@@ -872,9 +875,9 @@
};
-//--------------------------------------------------------------------------------
-// Bounding volume hierarchy classes
-
+/*--------------------------------------------------------------------------------
+ * Bounding volume hierarchy classes
+ */
template<class BV>
class BVNode {
public:
@@ -887,73 +890,75 @@
~BVNode();
- // List of all children of a given node
+ /* List of all children of a given node */
typedef std::vector<BVNode<BV>*> ChildList;
ChildList m_children;
- // Curve Tree associated with the parent Surface Tree
+ /* Curve Tree associated with the parent Surface Tree */
CurveTree* m_ctree;
- // Bounding Box
+ /* Bounding Box */
BV m_node;
- // Test if this node is a leaf node in the hierarchy
+ /* Test if this node is a leaf node in the hierarchy */
bool isLeaf();
- // Return all leaves below this node that are leaf nodes
+ /* Return all leaves below this node that are leaf nodes */
void getLeaves(std::list<BVNode<BV>*>& out_leaves);
- // Functions to add and remove child nodes from this node.
+ /* Functions to add and remove child nodes from this node. */
void addChild(const BV& child);
void addChild(BVNode<BV>* child);
void removeChild(const BV& child);
void removeChild(BVNode<BV>* child);
- // Report the depth of this node in the hierarchy
+ /* Report the depth of this node in the hierarchy */
int depth();
- // Get 2 points defining a bounding box
- //
- // _ max _
- // _ - + - _
- // * _ + _ *
- // | - _ + _ - |
- // | *+ |
- // | |+ |
- // | _ |+ _ |
- // | _ - | - _ |
- // * _ | _ *
- // - _ | _ -
- // min
- //
+ /* Get 2 points defining a bounding box
+ *
+ * _ max _
+ * _ - + - _
+ * * _ + _ *
+ * | - _ + _ - |
+ * | *+ |
+ * | |+ |
+ * | _ |+ _ |
+ * | _ - | - _ |
+ * * _ | _ *
+ * - _ | _ -
+ * min
+ */
void GetBBox(float* min, float* max);
void GetBBox(double* min, double* max);
- // Surface Information
+ /* Surface Information */
const ON_BrepFace* m_face;
ON_Interval m_u;
ON_Interval m_v;
- // Trimming Flags
+ /* Trimming Flags */
bool m_checkTrim;
bool m_trimmed;
- // Point used for closeness testing - usually
- // based on evaluation of the curve/surface at
- // the center of the parametric domain
+ /* Point used for closeness testing - usually based on evaluation
+ * of the curve/surface at the center of the parametric domain
+ */
ON_3dPoint m_estimate;
- // Normal at the m_estimate point
+ /* Normal at the m_estimate point */
ON_3dVector m_normal;
- // Test whether a ray intersects the 3D bounding volume
- // of the node - if so, and node is not a leaf node, query
- // children. If leaf node, and intersects, add to list.
+ /* Test whether a ray intersects the 3D bounding volume of the
+ * node - if so, and node is not a leaf node, query children. If
+ * leaf node, and intersects, add to list.
+ */
bool intersectedBy(ON_Ray& ray, double* tnear = 0, double* tfar = 0);
bool intersectsHierarchy(ON_Ray& ray, std::list<BVNode<ON_BoundingBox>*>&
results);
- // Report if a given uv point is within the uv boundaries
- // defined by a node.
+ /* Report if a given uv point is within the uv boundaries defined
+ * by a node.
+ */
bool containsUV(const ON_2dPoint& uv);
@@ -971,15 +976,16 @@
BVNode<BV>* closer(const ON_3dPoint& pt, BVNode<BV>* left, BVNode<BV>*
right);
std::list<BRNode*> m_trims_above;
std::list<BRNode*> m_trims_vertical;
- // std::list<BRNode*> m_trims_right;
+ /* std::list<BRNode*> m_trims_right; */
};
typedef BVNode<ON_BoundingBox> BBNode;
-
//--------------------------------------------------------------------------------
- // Template Implementation
+
/*--------------------------------------------------------------------------------
+ * Template Implementation
+ */
template<class BV>
inline
BVNode<BV>::BVNode()
@@ -1057,7 +1063,7 @@
template<class BV>
BVNode<BV>::~BVNode() {
- // delete the children
+ /* delete the children */
for (size_t i = 0; i < m_children.size(); i++) {
delete m_children[i];
}
@@ -1153,7 +1159,7 @@
} else {
double t1 = (m_node.m_min[i]-ray.m_origin[i]) / ray.m_dir[i];
double t2 = (m_node.m_max[i]-ray.m_origin[i]) / ray.m_dir[i];
- if (t1 > t2) { double tmp = t1; t1 = t2; t2 = tmp; } // swap
+ if (t1 > t2) { double tmp = t1; t1 = t2; t2 = tmp; } /* swap */
if (t1 > tnear) tnear = t1;
if (t2 < tfar) tfar = t2;
if (tnear > tfar) /* box is missed */ untrimmedresult = false;
@@ -1256,23 +1262,25 @@
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()}}; // include the estimate
+ {m_u.Mid(), m_v.Mid()}}; /* include the estimate */
ON_3dPoint corners[5];
const ON_Surface* surf = m_face->SurfaceOf();
u = m_u;
v = m_v;
- // ??? pass these in from SurfaceTree::surfaceBBox() to avoid this
recalculation?
+ /* ??? pass these in from SurfaceTree::surfaceBBox() to avoid
+ * this recalculation?
+ */
if (!surf->EvPoint(uvs[0][0], uvs[0][1], corners[0]) ||
!surf->EvPoint(uvs[1][0], uvs[1][1], corners[1]) ||
!surf->EvPoint(uvs[2][0], uvs[2][1], corners[2]) ||
!surf->EvPoint(uvs[3][0], uvs[3][1], corners[3])) {
- throw new std::exception(); // FIXME
+ throw new std::exception(); /* FIXME */
}
corners[4] = BVNode<BV>::m_estimate;
- // find the point on the surface closest to pt
+ /* find the point on the surface closest to pt */
size_t mini = 0;
double mindist = pt.DistanceTo(corners[mini]);
double tmpdist;
@@ -1311,7 +1319,7 @@
if ((pt.x >= (min[0])) && (pt.x <= (max[0])) &&
(pt.y >= (min[1])) && (pt.y <= (max[1])) &&
(pt.z >= (min[2])) && (pt.z <= (max[2]))) {
- // falls within BBox so put in list
+ /* falls within BBox so put in list */
out.push_back(this);
return 1;
}
@@ -1341,7 +1349,7 @@
if (trims.empty()) {
return 1;
- } else {//find closest BB
+ } else { /* find closest BB */
std::list<BRNode*>::iterator i;
BRNode* vclosest = NULL;
BRNode* uclosest = NULL;
@@ -1362,7 +1370,7 @@
if (br->m_Vertical) {
if ((br->m_v[0] <= uv[Y]) && (br->m_v[1] >= uv[Y])) {
double dist = fabs(uv[X] - br->m_v[0]);
- if (!verticalTrim) { //haven't seen vertical trim yet
+ if (!verticalTrim) { /* haven't seen vertical trim yet
*/
verticalTrim = true;
vdist = dist;
vclosest = br;
@@ -1457,7 +1465,7 @@
for (std::list<BRNode*>::const_iterator i = m_trims_above.begin(); i !=
m_trims_above.end(); i++) {
BRNode* br = dynamic_cast<BRNode*>(*i);
br->GetBBox(bmin, bmax);
- dist = 0.000001; //0.03*DIST_PT_PT(bmin, bmax);
+ dist = 0.000001; /* 0.03*DIST_PT_PT(bmin, bmax); */
if ((uv[X] > bmin[X]-dist) && (uv[X] < bmax[X]+dist))
out_leaves.push_back(br);
}
@@ -1496,7 +1504,6 @@
CurveTree* ct = m_ctree;
std::list<BRNode*>::iterator i;
BRNode* br;
- // point_t surfmin, surfmax;
point_t curvemin, curvemax;
double dist = 0.000001;
bool trim_already_assigned = false;
@@ -1512,36 +1519,36 @@
i = m_trims_above.begin();
while (i != m_trims_above.end()) {
br = dynamic_cast<BRNode*>(*i);
- if (br->m_Vertical) { // check V to see if trim possibly overlaps
+ if (br->m_Vertical) { /* check V to see if trim possibly overlaps */
br->GetBBox(curvemin, curvemax);
- if (curvemin[Y]-dist <= m_v[1]) { //possibly contains trim
can't rule out check closer
+ if (curvemin[Y]-dist <= m_v[1]) {
+ /* possibly contains trim can't rule out check
+ * closer */
m_checkTrim = true;
trim_already_assigned = true;
i++;
} else {
i = m_trims_above.erase(i);
}
- //i = m_trims_above.erase(i);
- //i++;
} else {
i++;
}
}
}
- if (!trim_already_assigned) { // already contains possible vertical trim
+ if (!trim_already_assigned) { /* already contains possible vertical trim */
if (m_trims_above.empty() /*|| m_trims_right.empty()*/) {
m_trimmed = true;
m_checkTrim = false;
- } else if (!m_trims_above.empty()) {//trimmed above check contains
+ } else if (!m_trims_above.empty()) { /*trimmed above check contains */
i = m_trims_above.begin();
br = dynamic_cast<BRNode*>(*i);
br->GetBBox(curvemin, curvemax);
- dist = 0.000001; //0.03*DIST_PT_PT(curvemin, curvemax);
+ dist = 0.000001; /* 0.03*DIST_PT_PT(curvemin, curvemax); */
if (curvemin[Y]-dist > m_v[1]) {
i++;
- if (i == m_trims_above.end()) { //easy only trim in above list
+ if (i == m_trims_above.end()) { /* easy only trim in above list
*/
if (br->m_XIncreasing) {
m_trimmed=true;
m_checkTrim=false;
@@ -1549,12 +1556,15 @@
m_trimmed=false;
m_checkTrim=false;
}
- } else { //check for trim bbox overlap TODO: look for multiple
overlaps
+ } else {
+ /* check for trim bbox overlap TODO: look for
+ * multiple overlaps.
+ */
BRNode* bs;
bs = dynamic_cast<BRNode*>(*i);
point_t smin, smax;
bs->GetBBox(smin, smax);
- if ((smin[Y] >= curvemax[Y]) || (smin[X] >= curvemax[X]) ||
(smax[X] <= curvemin[X])) { //can determine inside/outside without closer
inspection
+ if ((smin[Y] >= curvemax[Y]) || (smin[X] >= curvemax[X]) ||
(smax[X] <= curvemin[X])) { /* can determine inside/outside without closer
inspection */
if (br->m_XIncreasing) {
m_trimmed=true;
m_checkTrim=false;
@@ -1567,10 +1577,9 @@
}
}
} else {
- //m_contains_trim = true; //will have to check for trim at
shotline
m_checkTrim = true;
}
- } else {// something wrong here
+ } else { /* something wrong here */
bu_log("Error prepping trims");
return false;
}
@@ -1579,8 +1588,9 @@
}
-//--------------------------------------------------------------------------------
-// SurfaceTree declaration
+/*--------------------------------------------------------------------------------
+ * SurfaceTree declaration
+ */
class BREP_EXPORT SurfaceTree {
private:
bool m_removeTrimmed;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits