8.1
Geometry
| (require "../../racket/ctf/vector.rkt") | package: base |
Note: if you are using this code, it is assumed you will be working in (radians-mode)
1 Vector
To use vectors, make sure to put (require "../../racket/ctf/vector.rkt") at the top of your file.
procedure
x : number? y : number?
(vec x y) will return a value with the given x and y stored in it. You can then get out those values using vec-x and vec-y. For example (vec-y (vec 1 2.5)) returns 2.5.
Returns a new vector which is the sum vec1 and vec2
Returns a new vector which is vec1 minus v2
Returns a new vector which is vec1 scaled the c
Returns a new vector that is vec rotated angle radians to the right
Returns a vector whose magnitude is r and whose angle with the positive x-axis is angle
Returns the angle that vec makes with the positive x-axis
Returns the magnitude of vec
Returns the distance between vec1 and vec2
2 Line Like
To use line like, make sure to put (require "../../racket/ctf/ll.rkt") at the top of your file.
A "line like" (not a real term) is any shape that is a subset of a single line. The three that we are dealing with are: - Lines - Rays - Line Segments When we say line like, or ll, we are referring to any one of these 3 shapes.
Returns a line like that is treated as the line that goes through p1 and p2
Returns a line like that is treated as the line that starts at p,
and travels in the direction of the given angle
Returns a line like that is treated as the ray that starts at p,
and travels in the direction of the given angle
Returns a line like that is treated as the line segment
with ends at p1 and p2
Returns the angle above or below the positive x-axis of the line.
The value of angle-of-ll will always be in [-90,90)
Returns one point on the line like. If it’s a line segment or a ray
it will be one of its end points.
Same as ll-p1 except