POV-Ray

The Persistence of Vision Raytracer (POV-Ray).

This is the legacy Bug Tracking System for the POV-Ray project. Bugs listed here are being migrated to our github issue tracker. Please refer to that for new reports or updates to existing ones on this system.

Tasklist

FS#186 - numeric precision problem with polygon start/end points

Attached to Project: POV-Ray
Opened by Christoph Lipka (clipka) - Tuesday, 04 January 2011, 21:21 GMT
Last edited by Christoph Lipka (clipka) - Saturday, 26 February 2011, 00:36 GMT
Task Type Definite Bug
Category Backend → Geometric Primitives
Status Closed
Assigned To Christoph Lipka (clipka)
Operating System All
Severity Low
Priority Normal
Reported Version 3.70 RC1
Due in Version 3.70 RC2
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

polygon objects comprised of multiple “sub-polygons” don’t work properly if start/end points of sub-polygons do not exactly match, as can be demonstrated by the following code:

#default { texture { pigment { rgb 1 } finish { ambient 1.0} } }

camera {
  orthographic
  up 3.5*y
  right 3.5*x*image_width/image_height
  location  <0,0,-4>
  look_at   <0,0,0>
}

polygon { 8,
  // outer triangle
  0.70 * < cos(  0 *pi/180),sin(  0 *pi/180),0>
  0.70 * < cos(120 *pi/180),sin(120 *pi/180),0>
  0.70 * < cos(240 *pi/180),sin(240 *pi/180),0>
  0.70 * < cos(360 *pi/180),sin(360 *pi/180),0>

  // inner triangle
  0.35 * < cos(  0 *pi/180),sin(  0 *pi/180),0>
  0.35 * < cos(120 *pi/180),sin(120 *pi/180),0>
  0.35 * < cos(240 *pi/180),sin(240 *pi/180),0>
  0.35 * < cos(360 *pi/180),sin(360 *pi/180),0>
}

Note that the end points /should/ be identical. There are however some minor rounding differences, which mess up polygon computations. Compare with the following code, which leads to the desired results:

polygon { 8,
  // outer triangle
  0.70 * < cos(  0 *pi/180),sin(  0 *pi/180),0>
  0.70 * < cos(120 *pi/180),sin(120 *pi/180),0>
  0.70 * < cos(240 *pi/180),sin(240 *pi/180),0>
  0.70 * < cos(  0 *pi/180),sin(  0 *pi/180),0>

  // inner triangle
  0.35 * < cos(  0 *pi/180),sin(  0 *pi/180),0>
  0.35 * < cos(120 *pi/180),sin(120 *pi/180),0>
  0.35 * < cos(240 *pi/180),sin(240 *pi/180),0>
  0.35 * < cos(  0 *pi/180),sin(  0 *pi/180),0>
}

Code inspection shows that the polygon insideness testing code tests for precise equality of the points, whereas the general policy of POV-Ray is to accept slight rounding differences.

This task depends upon

Closed by  Christoph Lipka (clipka)
Saturday, 26 February 2011, 00:36 GMT
Reason for closing:  Fixed
Comment by Christoph Lipka (clipka) - Tuesday, 04 January 2011, 21:28 GMT
  • Field changed: Status (Investigating → Requires testing)
  • Field changed: Percent Complete (0% → 100%)

fixed with change #5343

Comment by Grimbert Jérôme (Le_Forgeron) - Wednesday, 05 January 2011, 18:13 GMT

I'm ok with that change (tested with my original scene: no more problem) with RC2/#5347, source linux, 64bits.

Loading...