I have no idea how to do this. I need to draw two lines that make an X through a circle, where the starting and end points would be on the circumference of the circle. If anybody could even give me a direction to go in to do this, it'd be appreciated.
1 Answers
Get the maths right first.
The most general case of circle-line intersection is described here: http://mathworld.wolfram.com/Circle-LineIntersection.html
But if the center of the circle is the origin, its radius is 1, and the lines are forming an x, so a 45 degree angle with the horizontal and vertical axes, it is quite a bit more simple:
The circle is defined by
x2 + y2 = 1
The line with 45 degree slope is defined by
y = x
Their intersections are the points (x,y) where both statements are true so
x2 + x2 = 1
2 x2 = 1
x2 = 1/2
x = sqrt(1/2) or x = -sqrt(1/2) and y = x
so points (sqrt(1/2), sqrt(1/2)) and (-sqrt(1/2), -sqrt(1/2))
Same for the other line.
One line goes from (-sqrt(0.5), -sqrt(0.5))
(bottom left) to (sqrt(0.5), sqrt(0.5))
(top right) and the other from (-sqrt(0.5), sqrt(0.5))
(top left) to (sqrt(0.5), -sqrt(0.5))
(bottom right).