Skip to content

Commit ca77957

Browse files
authored
Book edits as suggested by Shriram Krishnamurthi (#22)
Dr. Krishnamurthi is a professor of programming languages and was kind enough to read the first few chapters, and had some feedback about parts that were confusing. * I should explain the end vs. endAbsolute part better * Images of 2D sketches should be facing the camera so it's clear what actual shape they have (e.g. the circle looks like an oval) * Explain why 180deg in tangentialArc sometimes means up and sometimes means down
1 parent b0559b2 commit ca77957

File tree

6 files changed

+27
-8
lines changed

6 files changed

+27
-8
lines changed
4.11 KB
Loading
2.2 KB
Loading
-8.15 KB
Loading

kcl-book/src/sketch2d.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ Our third line heads back to the start of the profile, i.e. `[0, 0]`. We do this
6464

6565
Because this is the same point that our profile starts at, this line has looped our profile back to its start.
6666

67-
If we stopped our program here, you could see all three lines:
67+
We could have also used a relative line here, and looped back to the start with `line(end = [-3, -4])`. That would achieve the same thing. But this requires manual calculation. You, the programmer, have to look at all the previous lines and figure out how where the last line starts, and then "undo" all that distance by putting a line with the negative X and Y distances (so that the line goes back to the origin). In our example, this was easy, but in real-world designs this might be very tough! And even when it's easy, using an absolute point here communicates our intent better. We're just want to draw a line that returns to the start point. We don't really care about the distance here.
68+
69+
It doesn't really matter which one you use, although note that Zoo Design Studio will usually prefer relative lines for almost everything. Closing a sketch is the one exception where Zoo Design Studio will use an absolute line.
70+
71+
Now, if we stopped our program here, you could see all three lines:
6872

6973
![Result of running program 1](images/static/triangle_open.png)
7074

kcl-book/src/sketch2d_curves.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,20 @@ It should look like this:
2626

2727
Let's analyze this! It looks very similar to the triangle we sketched previously, but we're using `tangentialArc`. You can see it takes a relative `end`, i.e. an X distance and Y distance to move from the current point. It draws a nice smooth arc there.
2828

29-
We wrote this arc using `end`, i.e. an X and Y distance. But we could have defined this arc differently, using a `radius` and `angle` instead. You can replace the `tangentialArc(end = [0, height])` with `tangentialArc(angle = 180, radius = height)` instead, and it should draw the same thing.
29+
We wrote this arc using `end`, i.e. an X and Y distance. But we could have defined this arc differently, using a `radius` and `angle` instead (or a `diameter` and `angle`). You can replace the `tangentialArc(end = [0, height])` with `tangentialArc(angle = 180, radius = height)` instead, and it should draw the same thing.
30+
31+
```kcl
32+
height = 4
33+
width = 8
34+
startSketchOn(XZ)
35+
|> startProfile(at = [0, 0])
36+
|> xLine(length = width)
37+
|> tangentialArc(diameter = height, angle = 180deg)
38+
|> xLine(length = -width)
39+
|> tangentialArc(endAbsolute = profileStart())
40+
```
41+
42+
Here, the angle `180deg` is measuring a counterclockwise angle. To make the arc go the other direction (clockwise), you'd use `-180deg`.
3043

3144
The second `tangentialArc` call takes an absolute point. We tell it to draw an arc from the current point to the start of the profile. This should remind you of how straight lines can use either `end` (relative) or `endAbsolute`.
3245

@@ -53,14 +66,14 @@ It should look like this:
5366

5467
![A spiral made from many tangential arcs](images/static/spiral.png)
5568

56-
This works because each tangentialArc is drawing half a circle, away from the previous arc, and the circle is getting slightly larger each time.
69+
This works because each tangentialArc is drawing half a circle, away from the previous arc, and the circle is getting slightly larger each time. The `180` is a counterclockwise angle, so each time we draw a new arc, it bends around the circle counterclockwise.
5770

5871
## Circles
5972

6073
And lastly, let's look at the humble circle.
6174

6275
```kcl=basic_circle
63-
startSketchOn(XY)
76+
startSketchOn(XZ)
6477
|> circle(center = [0, 0], radius = 10)
6578
```
6679

kcl-book/src/sketch3d.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,28 +151,30 @@ You can make a sphere by revolving a semicircle its full 360 degrees. First, let
151151

152152
```kcl=semicircle
153153
radius = 10
154-
startSketchOn(XY)
154+
startSketchOn(XZ)
155155
|> startProfile(at = [0, 0])
156156
|> yLine(length = radius * 2)
157157
|> arc(angleStart = 90, angleEnd = 270, radius = radius)
158158
```
159159

160160
<!-- KCL: name=semicircle,skip3d=true,alt=Sketching a semicircle-->
161161

162-
Then we can `close()` it and add a call to `revolve(axis = Y, angle = 360)` to revolve it into a sphere:
162+
Then we can `close()` it and add a call to `revolve(axis = Y)` to revolve it 360 degrees into a sphere:
163163

164164
```kcl=sphere
165165
radius = 10
166-
startSketchOn(XY)
166+
startSketchOn(XZ)
167167
|> startProfile(at = [0, 0])
168168
|> yLine(length = radius * 2)
169169
|> arc(angleStart = 90, angleEnd = 270, radius = radius)
170170
|> close()
171-
|> revolve(axis = Y, angle = 360)
171+
|> revolve(axis = Y)
172172
```
173173

174174
<!-- KCL: name=sphere,skip3d=true,alt=Revolving a semicircle makes a sphere -->
175175

176+
Note that here, we omitted the `angle` argument from the `revolve` call because it defaults to 360 degrees.
177+
176178
## Lofts
177179

178180
All previous methods -- extrudes, sweeps, revolves -- took a single 2D shape and made a single 3D solid. Lofts are a little different -- they take _multiple_ 2D shapes and join them to make a single 3D shape. A loft interpolates between various sketches, creating a volume that smoothly blends from one shape into another. Let's see an example:

0 commit comments

Comments
 (0)