LDraw.org Discussion Forums
Working with primitives in Patterns - 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: Working with primitives in Patterns (/thread-5045.html)



Working with primitives in Patterns - Daniel Goerner - 2012-05-25

I admit, I don't have any clue how primitives work.
Chris suggested that I should change some circles made of triangles with primitives in one of my patterns.

So I tried that. The first thing that confused me is that I can't adjust the width of rings. A ring with the radius of 1 is too big, 2 ist too small.

Then, how can I assure that the primitives don't overlap? I can't select the vertices to see their position, so I don't know if the ring I put in another ring has the right size.

Then I finally got the first primitives in the right position (a circle, a ring and a squarecirclethingy around it) connected these with triangles with the rest of the pattern and checked that with edger2. The pattern looks right, the primitives look right. Just the connection between both: unmatched edges around the squarecirclethingy. How do i avoid that?

Seriously, I hate primitives as much as condlines.


Re: Working with primitives in Patterns - Tim Gould - 2012-05-25

Hi Daniel,

Could you maybe show the part you're working on? Would make it easier to help by example.

TIm


Re: Working with primitives in Patterns - Daniel Goerner - 2012-05-25

See attached lpc file.

[Edit] I also attached the exported dat.


Re: Working with primitives in Patterns - Willy Tschager - 2012-05-26

Daniel Görner Wrote:The first thing that confused me is that I can't adjust the width of rings. A ring with the radius of 1 is too big, 2 ist too small.

I guess I know what you're asking for. Use the rotation matrix do stretch rings. Check out the code in:

[dat_part 973pwa]

and examine how I authored the buttons using a black 4-4ring3.dat.

w.


Re: Working with primitives in Patterns - Chris Dee - 2012-05-26

I assume this is in response to my comments here and here.


Re: Working with primitives in Patterns - Chris Dee - 2012-05-26

Daniel Görner Wrote:The first thing that confused me is that I can't adjust the width of rings. A ring with the radius of 1 is too big, 2 ist too small.

The numeric suffix in the filename (4-4ringN) indicates the inner radius of the ring - the outer radius is always 1LDu greater. For example the 4-4ring4 primitive creates a ring with an inner radius of 4LDu and an outer radius of 5LDu. But you can scale the primitive with the matrix, so scaling 4-4ring4 by 0.25 would give a ring with an inner radius of 1LDu and an outer radius of 1.25 LDu.

The Rings and Cones utility written by Niels Karsdorp at http://www.philohome.com/isecalc/rings.htm is useful for calculating how do do this.


Re: Working with primitives in Patterns - Daniel Goerner - 2012-05-27

Can we cut that for now and go directly to question 3? The unmatched edges?


Re: Working with primitives in Patterns - Chris Dee - 2012-05-27

If for the "squarecirclethingy" you mean the 4-4ndisc primitive, then its edges should perfectly match a ring or disc primitive centred on the same point.


Re: Working with primitives in Patterns - Daniel Goerner - 2012-05-27

Oh, it does. What I mean is that the surrounding triangles dont match. See my attached file above.


Re: Working with primitives in Patterns - Chris Dee - 2012-05-27

Sorry - I don't understand what you are asking. To avoid T-junctions when building around a 4-4ndis you need only treat the corners and mid-points of the sides as vertices. Could you post a file just showing this problem?


Re: Working with primitives in Patterns - Nils Schmidt - 2012-05-27

Daniel Görner Wrote:[...] Just the connection between both: unmatched edges around the squarecirclethingy. How do i avoid that? [...]

I guess that you called edger2 with wrong parameters.

Try something like:

Code:
Edger2.exe -l E:\LDRAW -s  primtest.dat primteste.dat

where "E:\LDRAW" have to be substitued with the correct location of your LDRAW folder.

PS: Keep in mind that primitives have 4 digit decimal point accuracy. If you multiply it with a non-integer (like 1.5) the multiplication will lead to a 5th digit behind the decimal point. Normally you do not use these precision for the adjacent triangles.


Re: Working with primitives in Patterns - Daniel Goerner - 2012-05-27

Chris Dee Wrote:Could you post a file just showing this problem?

I did. Post 3 of this thread.


Re: Working with primitives in Patterns - Daniel Goerner - 2012-05-29

We have an adaptor ring (4-4aring.dat) to go from hi-res to lo-res (outside to inside). Do we have one to go from lo-res to hi-res? And if not, what would be better? Just put a hi-res ring and a lo-res ring together causing overlaps as in 4150ps5, or just use the hi-res ring and fill the gap to the edge of the part with triangles?

I'm just asking because I'm trying to redo 4150ps5 almost entirely with primitives (I had to write some 48 primitives myself, I just hope I did it right, please check the attached files) to make it look more like the actual pattern.


Re: Working with primitives in Patterns - Travis Cobbs - 2012-05-29

For patterned parts, I personally think overlapping would generally be better. Having said that, I suspect that this is a rare occurence. I assume that the only reason that hi-res primitives were used in 4150ps5 was due to the 6-way symmetry in the middle. Normally there wouldn't be a hi-res primitive inside a lo-res one.

It's worth noting that 4-4aring.dat has a logical thickness of 0. (Both the 48 circle and the 16 circle have a radius of 1 LDU.) And while an adaptor ring could be made that goes the other direction, it would be required to have a logical thickness greater than 0, and I suspect would be quite difficult to set up and use.

Note: I was not aware of 4-4aring.dat, so it isn't currently supported by LDView. However, it should be pretty trivial to add support, so I'll try to get that into the official 4.2 release.


Re: Working with primitives in Patterns - Daniel Goerner - 2012-05-29

Travis Cobbs Wrote:Note: I was not aware of 4-4aring.dat, so it isn't currently supported by LDView. However, it should be pretty trivial to add support, so I'll try to get that into the official 4.2 release.

I've just stumbled over it, because LPC offered it.


Re: Working with primitives in Patterns - Philippe Hurbain - 2012-05-29

IMHO present 4150ps5 is already pretty good!
I am not a great fan of primitives in patterns, as it is often impossible to properly match triangles to rings, you have to be very careful. In 4150ps5 you have a similar problem to match the hires ring to normal resolution part edge, I agree with Travis that overlap is the best way to do it.
Daniel Görner Wrote:I'm just asking because I'm trying to redo 4150ps5 almost entirely with primitives (I had to write some 48 primitives myself, I just hope I did it right, please check the attached files) to make it look more like the actual pattern.
No, you didn't. To have good matching between all primitives, they must all use the same rounding. I strongly suggest that you use PrimGen2 to create primitives.


Re: Working with primitives in Patterns - Daniel Goerner - 2012-05-29

Philippe \Philo\" Hurbain Wrote:IMHO present 4150ps5 is already pretty good!

No, the proportions are completely wrong.

Philippe \Philo\" Hurbain Wrote:I am not a great fan of primitives in patterns, as it is often impossible to properly match triangles to rings, you have to be very careful.

Me too, at least, because I'm still in the learning process, and the stuff I did the whole day I could have done with triangles in a few minutes. But I understand, that a version with primitives is preferred, because it's a lot smaller. But I need up to 5 rings per segment to get the width that I want, this is also "not so good". If I don't like what I get out of that, I'll go back to triangles.

Philippe \Philo\" Hurbain Wrote:I strongly suggest that you use PrimGen2 to create primitives.

GAWD! Why do I find out about a tool AFTER I spent hours and hours to find out how I can do it with the stuff I know??? I made the rings with LPC... If this forum had emoticons, you'd see here one that smashes its head with the keyboard.


Re: Working with primitives in Patterns - Philippe Hurbain - 2012-05-29

Quote:But I need up to 5 rings per segment to get the width that I want, this is also "not so good". If I don't like what I get out of that, I'll go back to triangles.
Yes, compactness of code is good, but part complexity (number of triangles) is even more!
Quote:If this forum had emoticons, you'd see here one that smashes its head with the keyboard.
;o)


Re: Working with primitives in Patterns - Daniel Goerner - 2012-05-30

I definitely go back to triangles, because I only have to make a 12th of the pattern which can be mirrored and rotated. Using primitives I'd have to use BFC INVERTNEXT which would result in even more code. And the subpart can be used in other parts like this.


Re: Working with primitives in Patterns - Chris Dee - 2012-05-30

You should never have to use BFC INVERTNEXT for a two-dimensional primitive (disc/ring/ndis).


Re: Working with primitives in Patterns - Daniel Goerner - 2012-05-30

You're right. My bad.