-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCS1101S M4.js
63 lines (42 loc) · 1.77 KB
/
CS1101S M4.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import {draw_connected_full_view, unit_circle, make_point, draw_connected, x_of, y_of, draw_connected_full_view_proportional} from "curve";
// Q1
// Part 1
// I don't understand but it should be line right?
// (number)-> f(number) -> point
// curve?
//your answer here (keep your answer commented)
// Part 2
function vertical_line(makepoint, length) {
const xcord = x_of(makepoint);
const ycord = y_of(makepoint);
return t => make_point(xcord, ycord+(length*t));
}
// Part 3
// I don't understand but it should be line right?
// (point,number) -> f(x_of(point),y_of(point) + (number*parameternumber)) -> (parameternumber->point)
// curve?
// your answer here (keep your answer commented)
// Part 4
draw_connected(90)(vertical_line(make_point(0.5,0.25),0.5));
//this is what the question is asking right?
// Q2
function three_quarters(pt) {
const xcord = x_of(pt);
const ycord = y_of(pt);
return t => make_point(math_cos(2*math_PI*(t*3/4))+xcord,math_sin(2*math_PI*(t*3/4))+ycord);
}
draw_connected_full_view_proportional(200)(three_quarters(make_point(0.5,0.25)));
//draw_connected_full_view_proportional(200)(three_quarters(make_point(0.5, 0.25)));
//draw_connected_full_view_proportional(200)(three_quarters(make_point(0,0)));
//makepoint => (x,y) =>makepoint(math_cos(2*math_PI*t+x),math_sin(2*math_PI*t+y)))(t)(1,1)(makepoint)
// Q3
function s_generator(pt) {
const xcord = x_of(pt);
const ycord = y_of(pt)+1;
const ycord2 = ycord -2;
return t => t <= 1/2
? make_point(math_cos(2*math_PI*(2*t*3/4))+xcord,math_sin(2*math_PI*(2*t*3/4))+ycord)
: make_point(math_cos(2*math_PI*(2*t*3/4))+xcord,math_sin(2*math_PI*(-2*t*3/4))+ycord2);
}
draw_connected_full_view_proportional(200)(s_generator(make_point(0.5, 0.25)));
*/