Rounding bug in PrimGen2? - Printable Version +- LDraw.org Discussion Forums (https://forums.ldraw.org) +-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html) +--- Forum: Parts Author Tools (https://forums.ldraw.org/forum-24.html) +--- Thread: Rounding bug in PrimGen2? (/thread-15039.html) |
Rounding bug in PrimGen2? - Max Martin Richter - 2014-12-28 Hej, I think, I found a rounding problem in PrimGen2. I'll continue to check all primitives for rounding errors, correct file ending and add a "generated with primgen" comment, when comparison is successful or the file is regenerated. Please see these lines: Code: 0 Cone 15 x 0.25 This problem seem to exist for cones only... /Max Re: Rounding bug in PrimGen2? - Philippe Hurbain - 2014-12-28 Indeed, problem lies in condlines values that are not rounded properly. The algorithm to get proper values for cones is sine(angle) rounded to 4 decimal places, multiplied by radius. This is done properly for quads, but condlines use sine(angle) multiplied by radius, rounded to 4dp. The rounding scheme may seem weird at first sight, but it ensures a perfect match with edges/discs that have a unit size, are rounded to 4dp and scaled to size when used. Re: Rounding bug in PrimGen2? - Max Martin Richter - 2014-12-28 After thinking over this problem again I would suggest the following solution: Change the calculation algorithm of the condline values to the algorithm of the quads values. This will not cause in hairline gaps for parts and changing the condlines will not result in any problems for the existing parts. /Max Re: Rounding bug in PrimGen2? - Chris Dee - 2014-12-28 Yes, that's correct - round first, then multiply by radius. Re: Rounding bug in PrimGen2? - Michael Heidemann - 2014-12-28 Are these lines better: 0 Name: 1-4con15.dat 0 Author: Michael Heidemann [mikeheide] 0 !LDRAW_ORG Unofficial_Primitive 0 !LICENSE Redistributable under CCAL version 2.0 : see CAreadme.txt 0 BFC CERTIFY CCW 4 16 15 1 0 13.8585 1 5.7405 14.7824 0 6.1232 16 0 0 4 16 13.8585 1 5.7405 10.6065 1 10.6065 11.3136 0 11.3136 14.7824 0 6.1232 4 16 10.6065 1 10.6065 5.7405 1 13.8585 6.1232 0 14.7824 11.3136 0 11.3136 4 16 5.7405 1 13.8585 0 1 15 0 0 16 6.1232 0 14.7824 0 // conditional lines 5 24 15 1 0 16 0 0 15 1 -6.213 13.8585 1 5.7405 5 24 13.8585 1 5.7405 14.7824 0 6.1232 15 1 0 10.6065 1 10.6065 5 24 10.6065 1 10.6065 11.3136 0 11.3136 13.8585 1 5.7405 5.7405 1 13.8585 5 24 5.7405 1 13.8585 6.1232 0 14.7824 10.6065 1 10.6065 0 1 15 5 24 0 1 15 0 0 16 5.7405 1 13.8585 -6.213 1 15 0 // Build by Primitive Generator 2 I had indeed forgot to use the rounding for the third and fourth vertice on optional lines. Sorry! Re: Rounding bug in PrimGen2? - Max Martin Richter - 2014-12-28 Yes, this seems to work. Do you prepare an update of PrimGen? /Max Re: Rounding bug in PrimGen2? - Michael Heidemann - 2014-12-28 Now, after I got a proof that my bugfix is correct - YES. Maybe tomorrow. Re: Rounding bug in PrimGen2? - Philippe Hurbain - 2014-12-28 Now since it only affect control points to less than the 3rd dp, the effect is completely unnoticeable!!! Re: Rounding bug in PrimGen2? - Max Martin Richter - 2014-12-28 Yes, it is. But it is weird to have different values for the control points than for the quads. /Max Re: Rounding bug in PrimGen2? - Michael Heidemann - 2014-12-29 The new version is online at http://ldraw.heidemann.org/index.php?page=primgen2 Have fun Re: Rounding bug in PrimGen2? - Max Martin Richter - 2014-12-29 Good that I finished the Wheels and Tyres, last night... Only the code pilot needs some more attention - but I'll check the prims first... /Max |