SHOW:
|
|
- or go back to the newest paste.
| 1 | (define CENTER (make-posn 200 200)) | |
| 2 | (define RADIUS 200) | |
| 3 | ||
| 4 | (define (circle-pt factor) | |
| 5 | (local | |
| 6 | ( | |
| 7 | (define ang (degrees->radians (fraction->degrees factor))) | |
| 8 | (define x (posn-x CENTER)) | |
| 9 | (define y (posn-y CENTER)) | |
| 10 | - | (define new-x (- x (* (* RADIUS (cos ang))))) |
| 10 | + | (define new-x (- x (* RADIUS (cos ang)))) |
| 11 | (define new-y (- y (* RADIUS (sin ang)))) | |
| 12 | ) | |
| 13 | (make-posn | |
| 14 | new-x | |
| 15 | new-y | |
| 16 | ) | |
| 17 | ) | |
| 18 | ) | |
| 19 | ||
| 20 | (define (fraction->degrees fraction) | |
| 21 | (* 360 fraction) | |
| 22 | ) | |
| 23 | ||
| 24 | (define (degrees->radians deg) | |
| 25 | (/(* deg pi) 180) | |
| 26 | ) |