3d-viewer, ray-tracing, do not add coincident segments
Fixes #1946 (lp 1852970)
(cherry picked from commit 518c1df81b
)
This commit is contained in:
parent
a4aec1919c
commit
6ab9bdb346
|
@ -429,8 +429,10 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
|
||||||
// Contains a closed polygon used to calc if points are inside
|
// Contains a closed polygon used to calc if points are inside
|
||||||
SEGMENTS segments;
|
SEGMENTS segments;
|
||||||
|
|
||||||
segments_and_normals.resize( path.PointCount() );
|
segments_and_normals.reserve( path.PointCount() );
|
||||||
segments.resize( path.PointCount() );
|
segments.reserve( path.PointCount() );
|
||||||
|
|
||||||
|
SFVEC2F prevPoint;
|
||||||
|
|
||||||
for( int i = 0; i < path.PointCount(); i++ )
|
for( int i = 0; i < path.PointCount(); i++ )
|
||||||
{
|
{
|
||||||
|
@ -439,9 +441,23 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
|
||||||
const SFVEC2F point ( (float)( a.x) * aBiuTo3DunitsScale,
|
const SFVEC2F point ( (float)( a.x) * aBiuTo3DunitsScale,
|
||||||
(float)(-a.y) * aBiuTo3DunitsScale );
|
(float)(-a.y) * aBiuTo3DunitsScale );
|
||||||
|
|
||||||
bbox.Union( point );
|
// Only add points that are not coincident
|
||||||
segments_and_normals[i].m_Start = point;
|
if( (i == 0) ||
|
||||||
segments[i].m_Start = point;
|
(fabs(prevPoint.x - point.x) > FLT_EPSILON) ||
|
||||||
|
(fabs(prevPoint.y - point.y) > FLT_EPSILON) )
|
||||||
|
{
|
||||||
|
prevPoint = point;
|
||||||
|
|
||||||
|
bbox.Union( point );
|
||||||
|
|
||||||
|
SEGMENT_WITH_NORMALS sn;
|
||||||
|
sn.m_Start = point;
|
||||||
|
segments_and_normals.push_back( sn );
|
||||||
|
|
||||||
|
POLYSEGMENT ps;
|
||||||
|
ps.m_Start = point;
|
||||||
|
segments.push_back( ps );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bbox.ScaleNextUp();
|
bbox.ScaleNextUp();
|
||||||
|
@ -517,13 +533,13 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
|
||||||
segments_and_normals[i].m_Normals.m_Start = normalSeg;
|
segments_and_normals[i].m_Normals.m_Start = normalSeg;
|
||||||
else
|
else
|
||||||
segments_and_normals[i].m_Normals.m_Start =
|
segments_and_normals[i].m_Normals.m_Start =
|
||||||
glm::normalize( (((normalBeforeSeg * dotBefore ) + normalSeg) * 0.5f) );
|
glm::normalize( (normalBeforeSeg * dotBefore ) + normalSeg );
|
||||||
|
|
||||||
if( dotAfter < 0.7f )
|
if( dotAfter < 0.7f )
|
||||||
segments_and_normals[i].m_Normals.m_End = normalSeg;
|
segments_and_normals[i].m_Normals.m_End = normalSeg;
|
||||||
else
|
else
|
||||||
segments_and_normals[i].m_Normals.m_End =
|
segments_and_normals[i].m_Normals.m_End =
|
||||||
glm::normalize( (((normalAfterSeg * dotAfter ) + normalSeg) * 0.5f) );
|
glm::normalize( (normalAfterSeg * dotAfter ) + normalSeg );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aDivFactor == 0.0f )
|
if( aDivFactor == 0.0f )
|
||||||
|
|
Loading…
Reference in New Issue