Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2016-04-05 10:08:45 +0300
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2016-04-05 10:15:09 +0300
commitdb28ff54d650af69bfa6001c60548fcd689382e2 (patch)
treecd46606e1f92e01dcd39a0072f2c74ac66824396
parent9c952bbe854d91034bed3c4e154e6e25ae56ef7d (diff)
Fix T47705: Freestyle line glitch.
The addressed issue is a regression from Blender 2.75, after the internal switch from double to single precision floating-point numbers in the Freestyle code base. Face normal calculations require the higher precision during the computations, even though the results can be stored as single precision numbers.
-rw-r--r--source/blender/freestyle/intern/winged_edge/WEdge.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.cpp b/source/blender/freestyle/intern/winged_edge/WEdge.cpp
index 87ca3a4235f..99aa2d22239 100644
--- a/source/blender/freestyle/intern/winged_edge/WEdge.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WEdge.cpp
@@ -640,18 +640,19 @@ WFace *WShape::MakeFace(vector<WVertex *>& iVertexList, vector<bool>& iFaceEdgeM
vector<WVertex *>::iterator it;
// compute the face normal (v1v2 ^ v1v3)
- WVertex *v1, *v2, *v3;
+ // Double precision numbers are used here to avoid truncation errors [T47705]
+ Vec3r v1, v2, v3;
it = iVertexList.begin();
- v1 = *it;
+ v1 = (*it)->GetVertex();
it++;
- v2 = *it;
+ v2 = (*it)->GetVertex();
it++;
- v3 = *it;
+ v3 = (*it)->GetVertex();
- Vec3f vector1(v2->GetVertex() - v1->GetVertex());
- Vec3f vector2(v3->GetVertex() - v1->GetVertex());
+ Vec3r vector1(v2 - v1);
+ Vec3r vector2(v3 - v1);
- Vec3f normal(vector1 ^ vector2);
+ Vec3r normal(vector1 ^ vector2);
normal.normalize();
face->setNormal(normal);