Primitives Reference: Difference between revisions
Holly-Wood (talk | contribs) No edit summary |
(Updated ring prims up to r=11) |
||
Line 458: | Line 458: | ||
''Currently available primitives:''<br> | ''Currently available primitives:''<br> | ||
Regular resolution:<br> | Regular resolution:<br> | ||
r=1 : 1-16rin1, 1-8ring1, 3-16rin1, 1-4ring1, 3-8ring1, 7-16rin1, 2-4ring1, 5-8ring1, 3-4ring1, 7-8ring1, 4-4ring1<br> | r=1 : 1-16rin1, 1-8ring1, 3-16rin1, 1-4ring1, 5-16ring1, 3-8ring1, 7-16rin1, 2-4ring1, 9-16ring1, 5-8ring1, 3-4ring1, 7-8ring1, 4-4ring1<br> | ||
r=2 : 1-16rin2, 1-8ring2, 3-16rin2, 1-4ring2, 5-16rin2, 3-8ring2, 7-16ring2, 2-4ring2, 5-8ring2, 3-4ring2, 7-8ring2, 4-4ring2<br> | r=2 : 1-16rin2, 1-8ring2, 3-16rin2, 1-4ring2, 5-16rin2, 3-8ring2, 7-16ring2, 2-4ring2, 5-8ring2, 3-4ring2, 7-8ring2, 4-4ring2<br> | ||
r=3 : 1-16rin3, 1-8ring3, 3-16rin3, 1-4ring3, 5-16rin3, 3-8ring3, 7-16rin3, 2-4ring3, 5-8ring3, 3-4ring3, 7-8ring3, 4-4ring3<br> | r=3 : 1-16rin3, 1-8ring3, 3-16rin3, 1-4ring3, 5-16rin3, 3-8ring3, 7-16rin3, 2-4ring3, 5-8ring3, 3-4ring3, 7-8ring3, 4-4ring3<br> | ||
r=4 : 1-16rin4, 1-8ring4, 3-16rin4, 1-4ring4, 3-8ring4, 7-16rin4, 2-4ring4, 5-8ring4, 3-4ring4, 4-4ring4<br> | r=4 : 1-16rin4, 1-8ring4, 3-16rin4, 1-4ring4, 5-16ring4, 3-8ring4, 7-16rin4, 2-4ring4, 5-8ring4, 3-4ring4, 4-4ring4<br> | ||
r=5 : 1-8ring5, 3-16rin5, 1-4ring5, 5-16rin5, 3-8ring5, 2-4ring5, 3-4ring5, 4-4ring5<br> | r=5 : 1-8ring5, 3-16rin5, 1-4ring5, 5-16rin5, 3-8ring5, 2-4ring5, 3-4ring5, 4-4ring5<br> | ||
r=6 : 1-8ring6, 3-16rin6, 1-4ring6, 3-8ring6, 2-4ring6, 5-8ring6, 3-4ring6, 4-4ring6<br> | r=6 : 1-16ring6, 1-8ring6, 3-16rin6, 1-4ring6, 3-8ring6, 7-16ring6, 2-4ring6, 5-8ring6, 3-4ring6, 4-4ring6<br> | ||
r=7 : 1-8ring7, 3-16rin7, 1-4ring7, 3-8ring7, 2-4ring7, 3-4ring7, 4-4ring7<br> | r=7 : 1-8ring7, 3-16rin7, 1-4ring7, 5-16ring7, 3-8ring7, 7-16ring7, 2-4ring7, 3-4ring7, 4-4ring7<br> | ||
r=8 : 1-8ring8, 3-16rin8, 1-4ring8, 3-8ring8, 2-4ring8, 3-4ring8, 7-8ring8, 4-4ring8<br> | r=8 : 1-16ring8, 1-8ring8, 3-16rin8, 1-4ring8, 5-16ring8, 3-8ring8, 7-16ring8, 2-4ring8, 3-4ring8, 7-8ring8, 4-4ring8<br> | ||
r=9 : 1-8ring9, 3-16rin9, 1-4ring9, 3-8ring9, 7-16ring9, 2-4ring9, 3-4ring9, 7-8ring9, 4-4ring9<br> | r=9 : 1-16ring9, 1-8ring9, 3-16rin9, 1-4ring9, 5-16ring9, 3-8ring9, 7-16ring9, 2-4ring9, 3-4ring9, 7-8ring9, 4-4ring9<br> | ||
r=10 : 1-8rin10, 1-4rin10, 3-8rin10, 2-4rin10, 5-8ring10, 3-4rin10, 4-4rin10<br> | r=10 : 1-8rin10, 3-16ring10, 1-4rin10, 3-8rin10, 2-4rin10, 5-8ring10, 3-4rin10, 4-4rin10<br> | ||
r=11 : 1-16ring11, 3-16ring11, 1-4rin11, 2-4rin11, 4-4rin11<br> | r=11 : 1-16ring11, 1-8ring11, 3-16ring11, 1-4rin11, 7-16ring11, 2-4rin11, 4-4rin11<br> | ||
r=12 : 1-8ring12, 3-16ring12, 1-4rin12, 5-16ring12, 3-8rin12, 2-4rin12, 7-8rin12, 4-4rin12<br> | r=12 : 1-8ring12, 3-16ring12, 1-4rin12, 5-16ring12, 3-8rin12, 2-4rin12, 7-8rin12, 4-4rin12<br> | ||
r=13 : 3-16ring13, 1-4rin13, 3-8rin13, 2-4rin13, 4-4rin13<br> | r=13 : 3-16ring13, 1-4rin13, 3-8rin13, 2-4rin13, 4-4rin13<br> | ||
Line 515: | Line 515: | ||
<br> | <br> | ||
High resolution:<br> | High resolution:<br> | ||
r=1 : 1-12rin1, 1-8ring1, 1-6ring1, 1-4ring1, 2-4ring1<br> | r=1 : 1-24ring1, 1-12rin1, 1-8ring1, 1-6ring1, 3-16ring1, 11-48ring1, 1-4ring1, 5-16ring1, 7-16ring1, 2-4ring1, 4-4ring1.dat<br> | ||
r=2 : 1-12rin2, 1-8ring2, 1-4ring2, 1-3ring2, 2-4ring2, 4-4ring2<br> | r=2 : 1-24ring2, 1-16ring2, 1-12rin2, 5-48ring2, 1-8ring2, 1-6ring2, 3-16ring2, 5-24ring2, 1-4ring2, 1-3ring2, 3-8ring2, 7-16ring2, 2-4ring2, 19-24ring2, 7-8ring2, 4-4ring2<br> | ||
r=3 : 1-24rin3, 1-16rin3, 1-12ring3, 1-8ring3, 1-6ring3, 1-4ring3, 7-16rin3, 2-4ring3, 4-4ring3<br> | r=3 : 1-24rin3, 1-16rin3, 1-12ring3, 1-8ring3, 7-48ring3, 1-6ring3, 5-24ring3, 1-4ring3, 1-3ring3, 7-16rin3, 2-4ring3, 4-4ring3<br> | ||
r=4 : 1-24rin4, 1-12ring4, 5-48rin4, 1-8ring4, 1-4ring4, 7-24rin4, 2-4ring4, 4-4ring4<br> | r=4 : 1-24rin4, 1-12ring4, 5-48rin4, 1-8ring4, 7-48ring4, 5-24ring4, 1-4ring4, 7-24rin4, 2-4ring4, 4-4ring4<br> | ||
r=5 : 1-24rin5, 1-12rin5, 5- | r=5 : 1-24rin5, 1-12rin5, 5-48ring5, 1-8ring5, 7-48rin5, 1-6ring5, 5-24ring5, 1-4ring5, 2-4ring5, 4-4ring5<br> | ||
r=6 : 1-48rin6, 1-24rin6, 1-12rin6, 1-8ring6, 5-24ring6, 2-4ring6, 5-6ring6, 4-4ring6<br> | r=6 : 1-48rin6, 1-24rin6, 1-16ring6, 1-12rin6, 1-8ring6, 1-6ring6, 5-24ring6, 1-4ring6, 2-4ring6, 5-6ring6, 4-4ring6<br> | ||
r=7 : 1-24rin7, 1-8ring7, 1-6ring7, 3-16rin7, 5-24rin7, 2-3ring7, 3-4ring7, 4-4ring7<br> | r=7 : 1-24rin7, 1-16ring7, 1-8ring7, 7-48ring7, 1-6ring7, 3-16rin7, 5-24rin7, 1-4ring7, 2-3ring7, 3-4ring7, 4-4ring7<br> | ||
r=8 : 1-16rin8, 1-12rin8, 1-8ring8, 1-6ring8, 3-16rin8, 1-4ring8, 4-4ring8<br> | r=8 : 1-16rin8, 1-12rin8, 1-8ring8, 7-48ring8, 1-6ring8, 3-16rin8, 5-24ring8, 1-4ring8, 11-24ring8, 4-4ring8<br> | ||
r=9 : 1-48rin9, 1-24rin9, 1-12rin9, 5-48rin9, 1-8ring9, 5-24rin9, 1-6ring9, 1-4ring9, 1-3ring9, 2-4ring9, 4-4ring9<br> | r=9 : 1-48rin9, 1-24rin9, 1-12rin9, 5-48rin9, 1-8ring9, 5-24rin9, 11-48ring9, 1-6ring9, 1-4ring9, 1-3ring9, 2-4ring9, 4-4ring9<br> | ||
r=10 : 7-48ring10, 1- | r=10 : 1-24ring10, 1-16ring10, 1-12ring10, 5-48ring10, 1-8ring10, 7-48ring10, 1-6ring10, 5-24ring10, 1-4rin10, 2-4ring10, 4-4rin10<br> | ||
r=11 : 1-24ring11, 1-4rin11, 2-4rin11, 4-4rin11<br> | r=11 : 1-24ring11, 1-16ring11, 1-8ring11, 7-48ring11, 3-16ring11, 1-4rin11, 7-16ring11, 2-4rin11, 4-4rin11<br> | ||
r=12 : 1-12ring12, 1-4ring12, 1-6rin12, 2-4rin12, 4-4rin12<br> | r=12 : 1-12ring12, 1-4ring12, 1-6rin12, 2-4rin12, 4-4rin12<br> | ||
r=13 : 1-16ring13, 1-6rin13, 5-24ring13, 1-4rin13, 5-12ring13, 11-24ring13, 3-4rin13, 4-4rin13<br> | r=13 : 1-16ring13, 1-6rin13, 5-24ring13, 1-4rin13, 5-12ring13, 11-24ring13, 3-4rin13, 4-4rin13<br> | ||
Line 584: | Line 584: | ||
r=179 : 1-4ring179<br> | r=179 : 1-4ring179<br> | ||
r=240 : 2-4ring240<br> | r=240 : 2-4ring240<br> | ||
<br> | |||
Low resolution:<br> | |||
r=2 : 2-4ring2, 4-4ring2<br> | |||
r=3 : 1-4ring3, 4-4ring3<br> | |||
r=6 : 4-4ring6<br> | |||
r=7 : 4-4ring7<br> | |||
r=11 : 4-4ring11<br> | |||
|} | |} |
Revision as of 21:14, 30 November 2023
LDraw Primitives Reference
This page is a source of reference for the LDraw primitives in the \LDraw\p directory. Primitives are defined as highly re-usable components of LEGO parts modelled for LDraw. They serve several purposes :
* To speed up parts authoring by providing a library of components which can be incorporated into several parts * To allow rendering software to make substitutions of curved components
Within this reference material the available primitives are categorised into:
Each section contains an overview of the characteristics common to all primitives within that category. Primitives are grouped into classes within each category - one class of primitive serving a similar purpose at different sizes or resolutions. For each class of primitive, a brief description of the purpose of the primitive is provided, with notes on its co-ordinate origin, default size and rules for scaling. A list of the available primitives is shown.
An understanding of the orientation of the co-ordinate axes is essential for authoring a part for LDraw. For reference within this page the axes and their direction is shown in this diagram.
Rectilinear primitives
These rectilinear elements may be scaled in the {x}, {y} and {z} dimensions to make elements of any size. For example
1 16 0 0 0 40 0 0 0 1 0 0 0 20 rect.dat
would generate a 80LDu x 40LDu rectangle in the {x,z} plane.
Although the default orientation of the rect.dat primitive is in the {x,z} plane the LDraw language allows for this to be transformed
1 16 0 0 0 0 1 0 40 0 0 0 0 20 rect.dat
would generate a 80LDu x 40LDu rectangle in the {y,z} plane.
1 16 0 0 0 40 0 0 0 0 20 0 1 0 rect.dat
would generate a 80LDu x 40LDu rectangle in the {x,y} plane.
Curved primitives
LDraw represents curved surfaces as polygons. For circular components two series of primitives are provided.
All the circular primitives are orientated in the {x,z} plane with their origin at the centre of the circle and a default radius of 1 LDu. Primitives are provided for complete circles and for commonly used fractions of a complete circle. Where the naming convention includes a prefix of the form n-f this indicates the fraction (n/f) of the circle drawn by the primitive. Where this fraction is less than an entire circle, the primitive starts at {+x,0} and progresses in a conterclockwise direction when viewed from above {-y}.
To avoid rounding errors, it is preferable to use existing fractional circular primitives, or create a new primitive, rather than rotate an existing primitive by anything other than 90 or 180 degrees. For example, use 3-16XXXX.dat rather than combining 1-8XXXX.dat with 1-16XXXX.dat rotated by 22.5 degreees.
To avoid matrix arithmetic problems in some renderers, the third dimension ({y} in the default orientation) of two-dimensional primitives must be given a non-zero scaling factor. LDraw circles are normally formed of 16-sided polygons (hexdecagons) - the regular resolution. For larger elements, where scaling-up of hexadecagons would give too angular an appearance, a series of high resolution primitives based on a 48-sided polygon are available. These may also be used for parts not well suited to a 16-fold symmetry.
These circular elements may be scaled by the same factor in both the {x} and {z} dimensions to make circular elements of greater or less than 1LDu radius. For example
1 16 0 0 0 3 0 0 0 1 0 0 0 3 4-4edge.dat
would generate a circle in the {x,z} plane with a radius of 3LDu.
They may also be scaled asymmetrically in the x and z dimension to make ellipses.
Although the default orientation is in the {x,z} plane the LDraw language allows for these to be transformed
1 16 0 0 0 0 1 0 3 0 0 0 0 3 4-4edge.dat would generate a circle in the {y,z} plane
1 16 0 0 0 3 0 0 0 0 3 0 1 0 4-4edge.dat would generate a circle in the {x,y} plane