Freestyle: minor optimization for space in the FEdgeXDetector.
Member variables and auto variables were changed from real (double) to float in most part of the FEdgeXDetector (except for curvature computations).
This commit is contained in:
@@ -148,16 +148,16 @@ void FEdgeXDetector::preProcessShape(WXShape *iWShape)
|
||||
|
||||
void FEdgeXDetector::preProcessFace(WXFace *iFace)
|
||||
{
|
||||
Vec3r firstPoint = iFace->GetVertex(0)->GetVertex();
|
||||
Vec3r N = iFace->GetNormal();
|
||||
Vec3f firstPoint = iFace->GetVertex(0)->GetVertex();
|
||||
Vec3f N = iFace->GetNormal();
|
||||
|
||||
// Compute the dot product between V (=_Viewpoint - firstPoint) and N:
|
||||
Vec3r V;
|
||||
Vec3f V;
|
||||
if (_orthographicProjection) {
|
||||
V = Vec3r(0.0, 0.0, _Viewpoint.z() - firstPoint.z());
|
||||
V = Vec3f(0.0f, 0.0f, _Viewpoint.z() - firstPoint.z());
|
||||
}
|
||||
else {
|
||||
V = Vec3r(_Viewpoint - firstPoint);
|
||||
V = Vec3f(_Viewpoint - firstPoint);
|
||||
}
|
||||
N.normalize();
|
||||
V.normalize();
|
||||
@@ -168,7 +168,7 @@ void FEdgeXDetector::preProcessFace(WXFace *iFace)
|
||||
iFace->setZ(iFace->center().z() - _Viewpoint.z());
|
||||
}
|
||||
else {
|
||||
Vec3r dist_vec(iFace->center() - _Viewpoint);
|
||||
Vec3f dist_vec(iFace->center() - _Viewpoint);
|
||||
iFace->setZ(dist_vec.norm());
|
||||
}
|
||||
}
|
||||
@@ -273,33 +273,33 @@ void FEdgeXDetector::processSilhouetteShape(WXShape *iWShape)
|
||||
void FEdgeXDetector::ProcessSilhouetteFace(WXFace *iFace)
|
||||
{
|
||||
// SILHOUETTE LAYER
|
||||
Vec3r normal;
|
||||
Vec3f normal;
|
||||
// Compute the dot products between View direction and N at each vertex of the face:
|
||||
Vec3r point;
|
||||
Vec3f point;
|
||||
int closestPointId = 0;
|
||||
real dist, minDist = FLT_MAX;
|
||||
float dist, minDist = FLT_MAX;
|
||||
int numVertices = iFace->numberOfVertices();
|
||||
WXFaceLayer *faceLayer = new WXFaceLayer(iFace, Nature::SILHOUETTE, true);
|
||||
for (int i = 0; i < numVertices; i++) {
|
||||
point = iFace->GetVertex(i)->GetVertex();
|
||||
normal = iFace->GetVertexNormal(i);
|
||||
normal.normalize();
|
||||
Vec3r V;
|
||||
Vec3f V;
|
||||
if (_orthographicProjection) {
|
||||
V = Vec3r(0.0, 0.0, _Viewpoint.z() - point.z());
|
||||
V = Vec3f(0.0f, 0.0f, _Viewpoint.z() - point.z());
|
||||
}
|
||||
else {
|
||||
V = Vec3r(_Viewpoint - point);
|
||||
V = Vec3f(_Viewpoint - point);
|
||||
}
|
||||
V.normalize();
|
||||
real d = normal * V;
|
||||
float d = normal * V;
|
||||
faceLayer->PushDotP(d);
|
||||
// Find the point the closest to the viewpoint
|
||||
if (_orthographicProjection) {
|
||||
dist = point.z() - _Viewpoint.z();
|
||||
}
|
||||
else {
|
||||
Vec3r dist_vec(point - _Viewpoint);
|
||||
Vec3f dist_vec(point - _Viewpoint);
|
||||
dist = dist_vec.norm();
|
||||
}
|
||||
if (dist < minDist) {
|
||||
|
||||
Reference in New Issue
Block a user