![]() |
|
Question about creating a primitive - Printable Version +- LDraw.org Discussion Forums (https://forums.ldraw.org) +-- Forum: Models and Parts (https://forums.ldraw.org/forum-18.html) +--- Forum: Parts Authoring (https://forums.ldraw.org/forum-19.html) +--- Thread: Question about creating a primitive (/thread-29265.html) |
Question about creating a primitive - Manfred Schaefer - 2026-01-02 Hello, I would like to create a new primitive (4-4ring179.dat). To do this, I looked at the primitive 4-4ring18.dat. I noticed that the values of the individual points are, in my opinion, incorrect. A quarter circle consists of four circle segments. The angle of each piece of the quarter circle is 22.5°. The first line in the primitive file looks like this: 4 16 19 0 0 17.5541 0 7.2713 16.6302 0 6.8886 18 0 0 19 0 0 is the point at the bottom right of the first circular arc segment. For the second point counterclockwise, the following applies: x = cos(22.5°) * 19 ~ 0.923879 * 19 ~ 17.55371111 -> 17.5537 y = sin(22.5°) * 19 ~ 0.382683 * 19 ~ 7.27098521 -> 7.2709 These values differ from the values in the file. The deviation is very small, but it is there. My question is: is the value in the file correct and I have made a mistake in my thinking? If so, what is it? ![]() Best regards, Manfred RE: Question about creating a primitive - Rene Rechthaler - 2026-01-02 I think the "inaccuracies" are from the process/definition of the prims... a ring18 connects a cyl scaled x18 with one scaled x19, which means the rounding imperfections from the cyl prims get amplified. (I dont know exactly but it fits: edge/cyl prims have 0.9239 0 0.3827 for the 22.5° position, this multiplied with 19 results in your 17.5541 0 7.2713 values) RE: Question about creating a primitive - Philippe Hurbain - 2026-01-02 Your thinking is right, it's a question of rounding method. We calculate sin/cos of angle, then round these value to 4 decimal places, then scale these values by iner/ourter ring value. This order may seem weird at first sight as it actually lowers the precision, but it's done this way so that the vertices of a cylinder or and edge primitives (that have a 1.0 radius) exactly matches the ones of rings when scaled to fit the ring. Note that Primgen2 tool (either standalone or integrated into LDPE) manages all this for you ![]() ...and the real question: why do you need such a large ring radius? |