Code cleanup: indentation
This commit is contained in:
@@ -301,7 +301,7 @@ void Smoother::computeCurvature()
|
||||
|
||||
_curvature[i] = normalCurvature * _normal[i];
|
||||
if (lba + lbc > M_EPSILON)
|
||||
_curvature[i] /= (0.5 * lba + lbc);
|
||||
_curvature[i] /= (0.5 * lba + lbc);
|
||||
}
|
||||
_curvature[0] = _curvature[1];
|
||||
_curvature[_nbVertices - 1] = _curvature[_nbVertices - 2];
|
||||
@@ -325,7 +325,7 @@ void Smoother::computeCurvature()
|
||||
|
||||
_curvature[i] = normalCurvature * _normal[i];
|
||||
if (lba + lbc > M_EPSILON)
|
||||
_curvature[i] /= (0.5 * lba + lbc);
|
||||
_curvature[i] /= (0.5 * lba + lbc);
|
||||
|
||||
_normal[_nbVertices - 1] = _normal[0];
|
||||
_curvature[_nbVertices - 1] = _curvature[0];
|
||||
|
||||
@@ -56,7 +56,7 @@ LineRep *StrokeTesselator::Tesselate(Stroke *iStroke)
|
||||
}
|
||||
else {
|
||||
if (_overloadFrsMaterial)
|
||||
line->setFrsMaterial(_FrsMaterial);
|
||||
line->setFrsMaterial(_FrsMaterial);
|
||||
|
||||
line->setStyle(LineRep::LINE_STRIP);
|
||||
|
||||
|
||||
@@ -182,9 +182,9 @@ int VertexOrientation3DF0D::operator()(Interface0DIterator& iter)
|
||||
A = Vec3r(iter->getX(), iter->getY(), iter->getZ());
|
||||
}
|
||||
else {
|
||||
Interface0DIterator previous = iter;
|
||||
--previous ;
|
||||
A = Vec3r(previous->getX(), previous->getY(), previous->getZ());
|
||||
Interface0DIterator previous = iter;
|
||||
--previous ;
|
||||
A = Vec3r(previous->getX(), previous->getY(), previous->getZ());
|
||||
}
|
||||
Interface0DIterator next = iter;
|
||||
++next ;
|
||||
|
||||
@@ -138,28 +138,28 @@ static void findOccludee(FEdge *fe, G& grid, I& occluders, real epsilon, WFace *
|
||||
|
||||
if (p->rayIntersect(A, v, t, t_u, t_v)) {
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "\t\tRay " << A << " * " << v << " intersects at time " << t << endl;
|
||||
cout << "\t\t(v * normal) == " << (v * p->getNormal()) << " for normal " << p->getNormal() << endl;
|
||||
}
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "\t\tRay " << A << " * " << v << " intersects at time " << t << endl;
|
||||
cout << "\t\t(v * normal) == " << (v * p->getNormal()) << " for normal " << p->getNormal() << endl;
|
||||
}
|
||||
#endif
|
||||
if (fabs(v * p->getNormal()) > 0.0001) {
|
||||
if ((t > 0.0)) { // && (t<1.0))
|
||||
if (t < mint) {
|
||||
*oaWFace = oface;
|
||||
mint = t;
|
||||
noIntersection = false;
|
||||
fe->setOccludeeIntersection(Vec3r(A + t * v));
|
||||
if (fabs(v * p->getNormal()) > 0.0001) {
|
||||
if ((t > 0.0)) { // && (t<1.0))
|
||||
if (t < mint) {
|
||||
*oaWFace = oface;
|
||||
mint = t;
|
||||
noIntersection = false;
|
||||
fe->setOccludeeIntersection(Vec3r(A + t * v));
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "\t\tIs occludee" << endl;
|
||||
}
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "\t\tIs occludee" << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
occluders.reportDepth(A, v, t);
|
||||
occluders.reportDepth(A, v, t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,146 +246,146 @@ static int computeVisibility(ViewMap *viewMap, FEdge *fe, G& grid, real epsilon,
|
||||
I occluders(grid, center, epsilon);
|
||||
|
||||
for (occluders.initBeforeTarget(); occluders.validBeforeTarget(); occluders.nextOccluder()) {
|
||||
// If we're dealing with an exact silhouette, check whether we must take care of this occluder of not.
|
||||
// (Indeed, we don't consider the occluders that share at least one vertex with the face containing this edge).
|
||||
//-----------
|
||||
oface = occluders.getWFace();
|
||||
Polygon3r *p = occluders.getCameraSpacePolygon();
|
||||
real t, t_u, t_v;
|
||||
// If we're dealing with an exact silhouette, check whether we must take care of this occluder of not.
|
||||
// (Indeed, we don't consider the occluders that share at least one vertex with the face containing this edge).
|
||||
//-----------
|
||||
oface = occluders.getWFace();
|
||||
Polygon3r *p = occluders.getCameraSpacePolygon();
|
||||
real t, t_u, t_v;
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "\t\tEvaluating intersection for occluder " << (p->getVertices())[0] << (p->getVertices())[1] <<
|
||||
(p->getVertices())[2] << endl << "\t\t\tand ray " << vp << " * " << u << " (center " << center <<
|
||||
")" << endl;
|
||||
}
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "\t\tEvaluating intersection for occluder " << (p->getVertices())[0] << (p->getVertices())[1] <<
|
||||
(p->getVertices())[2] << endl << "\t\t\tand ray " << vp << " * " << u << " (center " << center <<
|
||||
")" << endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LOGGING
|
||||
Vec3r v(vp - center);
|
||||
real rl = v.norm();
|
||||
v.normalize();
|
||||
vector<Vec3r> points;
|
||||
// Iterate over vertices, storing projections in points
|
||||
for (vector<WOEdge*>::const_iterator woe = oface->getEdgeList().begin(), woend = oface->getEdgeList().end();
|
||||
woe != woend;
|
||||
woe++)
|
||||
{
|
||||
points.push_back(Vec3r((*woe)->GetaVertex()->GetVertex()));
|
||||
}
|
||||
Polygon3r p1(points, oface->GetNormal());
|
||||
Vec3r v1((p1.getVertices())[0]);
|
||||
real d = -(v1 * p->getNormal());
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "\t\tp: " << (p->getVertices())[0] << (p->getVertices())[1] << (p->getVertices())[2] << ", norm: " <<
|
||||
p->getNormal() << endl;
|
||||
cout << "\t\tp1: " << (p1.getVertices())[0] << (p1.getVertices())[1] << (p1.getVertices())[2] << ", norm: " <<
|
||||
p1.getNormal() << endl;
|
||||
}
|
||||
Vec3r v(vp - center);
|
||||
real rl = v.norm();
|
||||
v.normalize();
|
||||
vector<Vec3r> points;
|
||||
// Iterate over vertices, storing projections in points
|
||||
for (vector<WOEdge*>::const_iterator woe = oface->getEdgeList().begin(), woend = oface->getEdgeList().end();
|
||||
woe != woend;
|
||||
woe++)
|
||||
{
|
||||
points.push_back(Vec3r((*woe)->GetaVertex()->GetVertex()));
|
||||
}
|
||||
Polygon3r p1(points, oface->GetNormal());
|
||||
Vec3r v1((p1.getVertices())[0]);
|
||||
real d = -(v1 * p->getNormal());
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "\t\tp: " << (p->getVertices())[0] << (p->getVertices())[1] << (p->getVertices())[2] << ", norm: " <<
|
||||
p->getNormal() << endl;
|
||||
cout << "\t\tp1: " << (p1.getVertices())[0] << (p1.getVertices())[1] << (p1.getVertices())[2] << ", norm: " <<
|
||||
p1.getNormal() << endl;
|
||||
}
|
||||
#else
|
||||
real d = -((p->getVertices())[0] * p->getNormal());
|
||||
real d = -((p->getVertices())[0] * p->getNormal());
|
||||
#endif
|
||||
|
||||
if (face) {
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "\t\tDetermining face adjacency...";
|
||||
}
|
||||
#endif
|
||||
skipFace = false;
|
||||
|
||||
if (face == oface) {
|
||||
if (face) {
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << " Rejecting occluder for face concurrency." << endl;
|
||||
cout << "\t\tDetermining face adjacency...";
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
skipFace = false;
|
||||
|
||||
|
||||
for (vector<WVertex*>::iterator fv = faceVertices.begin(), fvend = faceVertices.end(); fv != fvend; ++fv) {
|
||||
if ((*fv)->isBoundary())
|
||||
continue;
|
||||
|
||||
WVertex::incoming_edge_iterator iebegin = (*fv)->incoming_edges_begin();
|
||||
WVertex::incoming_edge_iterator ieend = (*fv)->incoming_edges_end();
|
||||
for (ie = iebegin; ie != ieend; ++ie) {
|
||||
if ((*ie) == 0)
|
||||
continue;
|
||||
|
||||
WFace *sface = (*ie)->GetbFace();
|
||||
//WFace *sfacea = (*ie)->GetaFace();
|
||||
//if ((sface == oface) || (sfacea == oface))
|
||||
if (sface == oface) {
|
||||
skipFace = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (skipFace)
|
||||
break;
|
||||
}
|
||||
if (skipFace) {
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << " Rejecting occluder for face adjacency." << endl;
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// check whether the edge and the polygon plane are coincident:
|
||||
//-------------------------------------------------------------
|
||||
//first let us compute the plane equation.
|
||||
if (GeomUtils::COINCIDENT == GeomUtils::intersectRayPlane(origin, edge, p->getNormal(), d, t, epsilon)) {
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "\t\tRejecting occluder for target coincidence." << endl;
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
real x;
|
||||
if (p1.rayIntersect(center, v, x, t_u, t_v)) {
|
||||
cout << "\t\tRay should intersect at time " << (rl - x) << ". Center: " << center << ", V: " << v <<
|
||||
", RL: " << rl << ", T:" << x << endl;
|
||||
}
|
||||
else {
|
||||
cout << "\t\tRay should not intersect. Center: " << center << ", V: " << v << ", RL: " << rl << endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (p->rayIntersect(center, u, t, t_u, t_v)) {
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "\t\tRay " << center << " * " << u << " intersects at time " << t << " (raylength is " <<
|
||||
raylength << ")" << endl;
|
||||
cout << "\t\t(u * normal) == " << (u * p->getNormal()) << " for normal " << p->getNormal() << endl;
|
||||
}
|
||||
#endif
|
||||
if (fabs(u * p->getNormal()) > 0.0001) {
|
||||
if ((t > 0.0) && (t < raylength)) {
|
||||
if (face == oface) {
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "\t\tIs occluder" << endl;
|
||||
cout << " Rejecting occluder for face concurrency." << endl;
|
||||
}
|
||||
#endif
|
||||
if ( foundOccluders != NULL ) {
|
||||
ViewShape *vshape = viewMap->viewShape(oface->GetVertex(0)->shape()->GetId());
|
||||
foundOccluders->insert(vshape);
|
||||
}
|
||||
++qi;
|
||||
|
||||
if (! grid.enableQI())
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
occluders.reportDepth(center, u, t);
|
||||
|
||||
for (vector<WVertex*>::iterator fv = faceVertices.begin(), fvend = faceVertices.end(); fv != fvend; ++fv) {
|
||||
if ((*fv)->isBoundary())
|
||||
continue;
|
||||
|
||||
WVertex::incoming_edge_iterator iebegin = (*fv)->incoming_edges_begin();
|
||||
WVertex::incoming_edge_iterator ieend = (*fv)->incoming_edges_end();
|
||||
for (ie = iebegin; ie != ieend; ++ie) {
|
||||
if ((*ie) == 0)
|
||||
continue;
|
||||
|
||||
WFace *sface = (*ie)->GetbFace();
|
||||
//WFace *sfacea = (*ie)->GetaFace();
|
||||
//if ((sface == oface) || (sfacea == oface))
|
||||
if (sface == oface) {
|
||||
skipFace = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (skipFace)
|
||||
break;
|
||||
}
|
||||
if (skipFace) {
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << " Rejecting occluder for face adjacency." << endl;
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// check whether the edge and the polygon plane are coincident:
|
||||
//-------------------------------------------------------------
|
||||
//first let us compute the plane equation.
|
||||
if (GeomUtils::COINCIDENT == GeomUtils::intersectRayPlane(origin, edge, p->getNormal(), d, t, epsilon)) {
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "\t\tRejecting occluder for target coincidence." << endl;
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
real x;
|
||||
if (p1.rayIntersect(center, v, x, t_u, t_v)) {
|
||||
cout << "\t\tRay should intersect at time " << (rl - x) << ". Center: " << center << ", V: " << v <<
|
||||
", RL: " << rl << ", T:" << x << endl;
|
||||
}
|
||||
else {
|
||||
cout << "\t\tRay should not intersect. Center: " << center << ", V: " << v << ", RL: " << rl << endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (p->rayIntersect(center, u, t, t_u, t_v)) {
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "\t\tRay " << center << " * " << u << " intersects at time " << t << " (raylength is " <<
|
||||
raylength << ")" << endl;
|
||||
cout << "\t\t(u * normal) == " << (u * p->getNormal()) << " for normal " << p->getNormal() << endl;
|
||||
}
|
||||
#endif
|
||||
if (fabs(u * p->getNormal()) > 0.0001) {
|
||||
if ((t > 0.0) && (t < raylength)) {
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "\t\tIs occluder" << endl;
|
||||
}
|
||||
#endif
|
||||
if ( foundOccluders != NULL ) {
|
||||
ViewShape *vshape = viewMap->viewShape(oface->GetVertex(0)->shape()->GetId());
|
||||
foundOccluders->insert(vshape);
|
||||
}
|
||||
++qi;
|
||||
|
||||
if (! grid.enableQI())
|
||||
break;
|
||||
}
|
||||
|
||||
occluders.reportDepth(center, u, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,43 +197,43 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
|
||||
WSFace *bface = (WSFace *)GetBordingFace(i);
|
||||
if (bface) {
|
||||
if ((front()) ^ (bface->front())) { // fA->front XOR fB->front (true if one is 0 and the other is 1)
|
||||
// that means that the edge i of the face is a silhouette edge
|
||||
// CHECK FIRST WHETHER THE EXACTSILHOUETTEEDGE HAS NOT YET BEEN BUILT ON THE OTHER FACE (1 is enough).
|
||||
if (((WSExactFace *)bface)->exactSilhouetteEdge()) {
|
||||
// that means that this silhouette edge has already been built
|
||||
return ((WSExactFace *)bface)->exactSilhouetteEdge();
|
||||
}
|
||||
// Else we must build it
|
||||
WOEdge *woea, *woeb;
|
||||
real ta, tb;
|
||||
if (!front()) { // is it in the right order ?
|
||||
// the order of the WOEdge index is wrong
|
||||
woea = _OEdgeList[(i + 1) % numberOfEdges()];
|
||||
if (0 == i)
|
||||
woeb = _OEdgeList[numberOfEdges() - 1];
|
||||
else
|
||||
woeb = _OEdgeList[(i - 1)];
|
||||
ta = 0;
|
||||
tb = 1;
|
||||
}
|
||||
else {
|
||||
// the order of the WOEdge index is good
|
||||
if (0 == i)
|
||||
woea = _OEdgeList[numberOfEdges() - 1];
|
||||
else
|
||||
woea = _OEdgeList[(i - 1)];
|
||||
woeb = _OEdgeList[(i + 1) % numberOfEdges()];
|
||||
ta = 1;
|
||||
tb = 0;
|
||||
}
|
||||
// that means that the edge i of the face is a silhouette edge
|
||||
// CHECK FIRST WHETHER THE EXACTSILHOUETTEEDGE HAS NOT YET BEEN BUILT ON THE OTHER FACE (1 is enough).
|
||||
if (((WSExactFace *)bface)->exactSilhouetteEdge()) {
|
||||
// that means that this silhouette edge has already been built
|
||||
return ((WSExactFace *)bface)->exactSilhouetteEdge();
|
||||
}
|
||||
// Else we must build it
|
||||
WOEdge *woea, *woeb;
|
||||
real ta, tb;
|
||||
if (!front()) { // is it in the right order ?
|
||||
// the order of the WOEdge index is wrong
|
||||
woea = _OEdgeList[(i + 1) % numberOfEdges()];
|
||||
if (0 == i)
|
||||
woeb = _OEdgeList[numberOfEdges() - 1];
|
||||
else
|
||||
woeb = _OEdgeList[(i - 1)];
|
||||
ta = 0;
|
||||
tb = 1;
|
||||
}
|
||||
else {
|
||||
// the order of the WOEdge index is good
|
||||
if (0 == i)
|
||||
woea = _OEdgeList[numberOfEdges() - 1];
|
||||
else
|
||||
woea = _OEdgeList[(i - 1)];
|
||||
woeb = _OEdgeList[(i + 1) % numberOfEdges()];
|
||||
ta = 1;
|
||||
tb = 0;
|
||||
}
|
||||
|
||||
_pSmoothEdge = new ExactSilhouetteEdge(ExactSilhouetteEdge::VERTEX_VERTEX);
|
||||
_pSmoothEdge->setWOeA(woea);
|
||||
_pSmoothEdge->setWOeA(woeb);
|
||||
_pSmoothEdge->setTa(ta);
|
||||
_pSmoothEdge->setTb(tb);
|
||||
_pSmoothEdge = new ExactSilhouetteEdge(ExactSilhouetteEdge::VERTEX_VERTEX);
|
||||
_pSmoothEdge->setWOeA(woea);
|
||||
_pSmoothEdge->setWOeA(woeb);
|
||||
_pSmoothEdge->setTa(ta);
|
||||
_pSmoothEdge->setTb(tb);
|
||||
|
||||
return _pSmoothEdge;
|
||||
return _pSmoothEdge;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user