Primitives Reference: Difference between revisions
Holly-Wood (talk | contribs) No edit summary |
Holly-Wood (talk | contribs) No edit summary |
||
Line 101: | Line 101: | ||
|- | |- | ||
| '''box0.dat''' || '''Cuboid with no faces and edges''' | | '''box0.dat''' || '''Cuboid with no faces and edges''' | ||
|- | |- | ||
Line 108: | Line 107: | ||
|- | |- | ||
| '''box5.dat''' || '''Cuboid with 5 faces and all edges''' | | '''box5.dat''' || '''Cuboid with 5 faces and all edges''' | ||
|- | |- | ||
Line 115: | Line 113: | ||
|- | |- | ||
| '''box5-1.dat''' || '''Cuboid with 5 faces without 1 edge''' | | '''box5-1.dat''' || '''Cuboid with 5 faces without 1 edge''' | ||
|- | |- | ||
Line 122: | Line 119: | ||
|- | |- | ||
| '''box5-2p.dat''' || '''Cuboid with 5 faces without 2 parallel edges''' | | '''box5-2p.dat''' || '''Cuboid with 5 faces without 2 parallel edges''' | ||
|- | |- | ||
Line 129: | Line 125: | ||
|- | |- | ||
| '''box5-4a.dat''' || '''Cuboid with 5 faces without top edges''' | | '''box5-4a.dat''' || '''Cuboid with 5 faces without top edges''' | ||
|- | |- | ||
Line 136: | Line 131: | ||
|- | |- | ||
| '''box5-12.dat''' || '''Cuboid with 5 faces missing all edges''' | | '''box5-12.dat''' || '''Cuboid with 5 faces missing all edges''' | ||
|- | |- | ||
Line 143: | Line 137: | ||
|- | |- | ||
| '''box4.dat''' || '''Cuboid with 4 parallel faces and all edges''' | | '''box4.dat''' || '''Cuboid with 4 parallel faces and all edges''' | ||
|- | |- | ||
Line 150: | Line 143: | ||
|- | |- | ||
| '''box4o4a.dat''' || '''Cuboid with 4 parallel faces without bottom edges''' | | '''box4o4a.dat''' || '''Cuboid with 4 parallel faces without bottom edges''' | ||
|- | |- | ||
Line 157: | Line 149: | ||
|- | |- | ||
| '''box4o8a.dat''' || '''Cuboid with 4 parallel faces without top and bottom edges''' | | '''box4o8a.dat''' || '''Cuboid with 4 parallel faces without top and bottom edges''' | ||
|- | |- | ||
Line 164: | Line 155: | ||
|- | |- | ||
| '''box4t.dat''' || '''Cuboid with 4 adjacent and all edges''' | | '''box4t.dat''' || '''Cuboid with 4 adjacent and all edges''' | ||
|- | |- | ||
Line 171: | Line 161: | ||
|- | |- | ||
| '''box4-1.dat''' || '''Cuboid with 4 adjacent faces missing 1 edge''' | | '''box4-1.dat''' || '''Cuboid with 4 adjacent faces missing 1 edge''' | ||
|- | |- | ||
Line 178: | Line 167: | ||
|- | |- | ||
| '''box4-2p.dat''' || '''Cuboid with 4 faces without two opposite top edges''' | | '''box4-2p.dat''' || '''Cuboid with 4 faces without two opposite top edges''' | ||
|- | |- | ||
Line 185: | Line 173: | ||
|- | |- | ||
| '''box4-3p.dat''' || '''Cuboid with 4 faces without three parallel edges''' | | '''box4-3p.dat''' || '''Cuboid with 4 faces without three parallel edges''' | ||
|- | |- | ||
Line 192: | Line 179: | ||
|- | |- | ||
| '''box4-4a.dat''' || '''Cuboid with 4 adjacent faces missing 4 edges''' | | '''box4-4a.dat''' || '''Cuboid with 4 adjacent faces missing 4 edges''' | ||
|- | |- | ||
Line 199: | Line 185: | ||
|- | |- | ||
| '''box4-7a.dat''' || '''Cuboid with 4 adjacent faces missing 7 edges''' | | '''box4-7a.dat''' || '''Cuboid with 4 adjacent faces missing 7 edges''' | ||
|- | |- | ||
Line 206: | Line 191: | ||
|- | |- | ||
| '''box3-3.dat''' || '''Cuboid with 3 adjacent faces missing 3 edges''' | | '''box3-3.dat''' || '''Cuboid with 3 adjacent faces missing 3 edges''' | ||
|- | |- | ||
Line 213: | Line 197: | ||
|- | |- | ||
| '''box3-5a.dat''' || '''Cuboid with 4 adjacent faces missing 4 edges''' | | '''box3-5a.dat''' || '''Cuboid with 4 adjacent faces missing 4 edges''' | ||
|- | |- | ||
Line 220: | Line 203: | ||
|- | |- | ||
| '''box3-7a.dat''' || '''Cuboid with 3 adjacent faces missing 7 adjacent edges''' | | '''box3-7a.dat''' || '''Cuboid with 3 adjacent faces missing 7 adjacent edges''' | ||
|- | |- | ||
Line 227: | Line 209: | ||
|- | |- | ||
| '''box3-9a.dat''' || '''Cuboid with 3 adjacent faces missing 9 adjacent edges''' | | '''box3-9a.dat''' || '''Cuboid with 3 adjacent faces missing 9 adjacent edges''' | ||
|- | |- | ||
Line 234: | Line 215: | ||
|- | |- | ||
| '''box3-12.dat''' || '''Cuboid with 3 adjacent faces missing all edges''' | | '''box3-12.dat''' || '''Cuboid with 3 adjacent faces missing all edges''' | ||
|- | |- | ||
Line 241: | Line 221: | ||
| | | | ||
| '''box3u2p.dat''' || '''Cuboid with 3 faces missing 2 edges''' | | '''box3u2p.dat''' || '''Cuboid with 3 faces missing 2 edges''' | ||
|- | |- | ||
Line 248: | Line 227: | ||
|- | |- | ||
| '''box3u4p.dat''' || '''Cuboid with 3 faces missing 4 parallel edges''' | | '''box3u4p.dat''' || '''Cuboid with 3 faces missing 4 parallel edges''' | ||
|- | |- | ||
Line 255: | Line 233: | ||
|- | |- | ||
| '''box3u4a.dat''' || '''Cuboid with 3 adjacent faces missing all edges''' | | '''box3u4a.dat''' || '''Cuboid with 3 adjacent faces missing all edges''' | ||
|- | |- | ||
Line 262: | Line 239: | ||
| | | | ||
| '''box3u5p.dat''' || '''Cuboid with 3 faces missing 5 edges''' | | '''box3u5p.dat''' || '''Cuboid with 3 faces missing 5 edges''' | ||
|- | |- | ||
Line 269: | Line 245: | ||
|- | |- | ||
| '''box3u6.dat''' || '''Cuboid with 3 faces missing 6 edges''' | | '''box3u6.dat''' || '''Cuboid with 3 faces missing 6 edges''' | ||
|- | |- | ||
Line 276: | Line 251: | ||
|- | |- | ||
| '''box3u7a.dat''' || '''Cuboid with 3 faces missing 7 adjacent edges''' | | '''box3u7a.dat''' || '''Cuboid with 3 faces missing 7 adjacent edges''' | ||
|- | |- | ||
Line 283: | Line 257: | ||
|- | |- | ||
| '''box3u8p.dat''' || '''Cuboid with 3 faces missing 8 edges (in two parallel groups)''' | | '''box3u8p.dat''' || '''Cuboid with 3 faces missing 8 edges (in two parallel groups)''' | ||
|- | |- | ||
Line 290: | Line 263: | ||
|- | |- | ||
| '''box3u10p.dat''' || '''Cuboid with 3 faces in a 'U' shape, missing 10 edges (all except those between the faces)''' | | '''box3u10p.dat''' || '''Cuboid with 3 faces in a 'U' shape, missing 10 edges (all except those between the faces)''' | ||
|- | |- | ||
Line 297: | Line 269: | ||
|- | |- | ||
| '''box3u12.dat''' || '''Cuboid with 3 parallel faces missing all edges''' | | '''box3u12.dat''' || '''Cuboid with 3 parallel faces missing all edges''' | ||
|- | |- | ||
Line 304: | Line 275: | ||
|- | |- | ||
| '''boxjcyl4.dat''' || '''Box truncated by cylinder''' | | '''boxjcyl4.dat''' || '''Box truncated by cylinder''' | ||
|- | |- | ||
Line 314: | Line 284: | ||
|- | |- | ||
| '''box2-5.dat''' || '''Cuboid with 2 adjacent faces missing 5 edges''' | | '''box2-5.dat''' || '''Cuboid with 2 adjacent faces missing 5 edges''' | ||
|- | |- | ||
Line 321: | Line 290: | ||
|- | |- | ||
| '''box2-7.dat''' || '''Cuboid with 2 adjacent faces missing 7 edges''' | | '''box2-7.dat''' || '''Cuboid with 2 adjacent faces missing 7 edges''' | ||
|- | |- | ||
Line 328: | Line 296: | ||
|- | |- | ||
| '''box2-9.dat''' || '''Cuboid with 2 adjacent faces missing 9 edges (all except those connected to the {+x}, {+y}, {+z} vertex)''' | | '''box2-9.dat''' || '''Cuboid with 2 adjacent faces missing 9 edges (all except those connected to the {+x}, {+y}, {+z} vertex)''' | ||
|- | |- | ||
Line 335: | Line 302: | ||
|- | |- | ||
| '''box2-9p.dat''' || '''Cuboid with 2 adjacent faces missing 9 edges (all except three parallel edges)''' | | '''box2-9p.dat''' || '''Cuboid with 2 adjacent faces missing 9 edges (all except three parallel edges)''' | ||
|- | |- | ||
Line 342: | Line 308: | ||
|- | |- | ||
| '''box2-11.dat''' || '''Cuboid with 2 adjacent faces missing 11 edges''' | | '''box2-11.dat''' || '''Cuboid with 2 adjacent faces missing 11 edges''' | ||
|- | |- | ||
Line 349: | Line 314: | ||
|- | |- | ||
| '''tri3.dat''' || '''Right-angled triangular prism with 3 faces''' | | '''tri3.dat''' || '''Right-angled triangular prism with 3 faces''' | ||
|- | |- | ||
Line 356: | Line 320: | ||
|- | |- | ||
| '''tri3a1.dat''' || '''Right-angled triangular prism with 3 adjacent faces missing 1 edge''' | | '''tri3a1.dat''' || '''Right-angled triangular prism with 3 adjacent faces missing 1 edge''' | ||
|- | |- | ||
Line 363: | Line 326: | ||
|- | |- | ||
| '''tri3a4''' || '''Right-angled triangular prism with 3 adjacent faces missing 4 adjacent edges''' | | '''tri3a4''' || '''Right-angled triangular prism with 3 adjacent faces missing 4 adjacent edges''' | ||
|- | |- | ||
Line 370: | Line 332: | ||
|- | |- | ||
| '''tri3u1.dat''' || '''Right-angled triangular prism with 3 faces missing 1 edge''' | | '''tri3u1.dat''' || '''Right-angled triangular prism with 3 faces missing 1 edge''' | ||
|- | |- | ||
Line 377: | Line 338: | ||
|- | |- | ||
| '''tri3u3.dat''' || '''Right-angled triangular prism with 3 faces missing 3 edges''' | | '''tri3u3.dat''' || '''Right-angled triangular prism with 3 faces missing 3 edges''' | ||
|- | |- | ||
| [[File:tri3u3.png|200px|thumb|alt=Tri3u3]] | | [[File:tri3u3.png|200px|thumb|alt=Tri3u3]] | ||
|| This primitive represents a triangular prism missing the left {-x} and front {-z} faces, the edge where they would join and one edge of each of the triangles. Its origin is the right-angle corner of the top face and by default has a size of 1LDu in each of the {x} and {z} dimensions and 1LDu in the {y} dimension. | || This primitive represents a triangular prism missing the left {-x} and front {-z} faces, the edge where they would join and one edge of each of the triangles. Its origin is the right-angle corner of the top face and by default has a size of 1LDu in each of the {x} and {z} dimensions and 1LDu in the {y} dimension. | ||
| | |} | ||
==Curved primitives== | ==Curved primitives== |
Revision as of 06:21, 29 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.