Merge branch 'main' into patch-1
This commit is contained in:
@@ -23,13 +23,14 @@ circle(5);
|
||||
square([15,3]);
|
||||
```
|
||||
|
||||
`circle(5);` gives us a circle with a radius of `5` and `square` is the 2d version of `cube` . Here we've given it dimensions of 15 and 3 for x and y respectively (or width and height if you prefer) .
|
||||
`circle(5);` gives us a circle with a radius of `5` and `square` is the 2d version of `cube`.
|
||||
Here we've given it dimensions of 15 and 3 for x and y respectively (or width and height if you prefer).
|
||||
|
||||
<Image img={circleCube} className="mb-8 bg-contain rounded-md overflow-hidden" />
|
||||
|
||||
## Translate
|
||||
|
||||
It's a start but we need to shift things around a little (I've colored these so we can tell them apart). The cross-hairs represent the origin of the environment and we can see that lines up with the circle's center the corner of the square. Since `5` is the radius of the circle, if want the circle to sit on top of the origin we need to shift it up by the same amount, we do that with `translate` like so:
|
||||
It's a start but we need to shift things around a little (I've colored these so we can tell them apart). The cross-hairs represent the origin of the environment and we can see that lines up with the circle's center and the corner of the square. Since `5` is the radius of the circle, if we want the circle to sit on top of the origin we need to shift it up by the same amount. We do that with `translate` like so:
|
||||
|
||||
```cpp
|
||||
// highlight-next-line
|
||||
@@ -41,9 +42,9 @@ square([15,3]);
|
||||
|
||||
<Image img={translate} className="mb-8 bg-contain rounded-md overflow-hidden" />
|
||||
|
||||
`translate` is little different to the modules we've see so far is instead of ending with a semicolon `;` it ends with `{ children }` in the case above it has one child, the `circle`. `translate` shifts its children around, we're using it to shift it up by `5`. We put `5` in the second position in the square braces because we want to shift it along the Y axis, if you're ever not sure which axis you need to shift something, just try each until you find the one you're after.
|
||||
`translate` is a little different to the modules we've seen so far in that instead of ending with a semicolon `;` it ends with `{ children }`. In the case above it has one child, the `circle`. `translate` shifts its children around, we're using it to shift it up by `5`. We put `5` in the second position in the square braces because we want to shift it along the Y axis. If you're ever not sure which axis you need to shift something, just try each until you find the one you're after.
|
||||
|
||||
We also don't want to have the undercut where the circle meets the square, we can fix that with another square so that there's a nice 90 degree transition. Also for reasons we'll get to later, we don't actually want any overlap between these two squares so it will need shift with translate as well. Here's what we're left with:
|
||||
We also don't want to have the undercut where the circle meets the square, we can fix that with another square so that there's a nice 90 degree transition. Also for reasons we'll get to later, we don't actually want any overlap between these two squares so it will need a shift with translate as well. Here's what we're left with:
|
||||
|
||||
```cpp
|
||||
translate([0,5,0]){
|
||||
|
||||
Reference in New Issue
Block a user