From 33b65832d2002979c27b39a1fbe1d59f77a24565 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Sat, 13 Jul 2013 19:33:25 +0000 Subject: Fix for [#35482] 2.67 freestyle line visibility computation bug. The reported line visibility issue was caused by a wrong calculation of a 2D bounding box (so-called "proscenium face" in Freestyle) in the case of a spherical grid data structure used for a perspective camera. The problem was resulting from the proscenium computation based on two corners (min and max) of the 3D bounding box of imported mesh data. Aware of the spherical coordinate transformation involving non-linear (arctangent) functions, now the proscenium is computed by taking in account all the eight corners of the 3D bounding box. Also added minor code changes to facilitate future debugging. --- .../freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp') diff --git a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp index 61ad78a8567..952b9752a3e 100644 --- a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp +++ b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp @@ -100,10 +100,10 @@ void AverageAreaGridDensityProvider::initialize(const real proscenium[4], real s // Make sure the grid exceeds the proscenium by a small amount float safetyZone = 0.1f; if (_cellsX * _cellSize < prosceniumWidth * (1.0 + safetyZone)) { - _cellsX = prosceniumWidth * (1.0 + safetyZone) / _cellSize; + _cellsX = ceil(prosceniumWidth * (1.0 + safetyZone) / _cellSize); } if (_cellsY * _cellSize < prosceniumHeight * (1.0 + safetyZone)) { - _cellsY = prosceniumHeight * (1.0 + safetyZone) / _cellSize; + _cellsY = ceil(prosceniumHeight * (1.0 + safetyZone) / _cellSize); } if (G.debug & G_DEBUG_FREESTYLE) { cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl; -- cgit v1.2.3