I''d appreciate a little help with this trig problem. See diagram here:
www.ai-junkie.com/occluded_segment.jpg
Given A, B, C, D and r, what''s the best (read fastest) way to calculate p1 and p2?
thanks guys (and gals?)
ai-junkie.com
Trig question
My Website: ai-junkie.com | My Books: 'Programming Game AI by Example' & 'AI Techniques for Game Programming'
Is the line AB necessarily horizontal? If so, the fasatest way is probably with some similar triangles that all have one vertical leg and one horizontal leg. Otherwise, I would just use some vectory math.
Is this for ray tracing?
Is this for ray tracing?
You know what I never noticed before?
February 19, 2003 08:39 PM
quote:
Original post by fup
Given A, B, C, D and r, what''s the best (read fastest) way to calculate p1 and p2?
Please clarify what we''re given and what we''re looking for. Are A, B, C, and D points with coordinates? If so, do you know what''s the purpose of A and B? Are p1 and p2 angles or points? Is there any more given stuff or is that it?
February 19, 2003 08:41 PM
do you know the exact coordinates of A,B,C,D, or just the relative distances?
I guess you could look at it as a ray tracing problem. (in 2D)
The line segment AB is defined by two 2D points A & B. p1, p2, D and C are also 2D points. Each point is defined by an x and y coordinate.
Imagine C as a light source. p1 and p2 are the end points of the shadow cast on AB by the object at point D with radius r.
Hope this clarifies the problem.
ai-junkie.com
The line segment AB is defined by two 2D points A & B. p1, p2, D and C are also 2D points. Each point is defined by an x and y coordinate.
Imagine C as a light source. p1 and p2 are the end points of the shadow cast on AB by the object at point D with radius r.
Hope this clarifies the problem.
ai-junkie.com
My Website: ai-junkie.com | My Books: 'Programming Game AI by Example' & 'AI Techniques for Game Programming'
My Website: ai-junkie.com | My Books: 'Programming Game AI by Example' & 'AI Techniques for Game Programming'
You can use an isosceles triangle. Take the line between the light source and the center of the cirlce, and the base of the isosceles triangle will be perpendicular to that line, also going through the center of the circle. There are then two different ways to accomplish the projection. Given radius R, you can find those tangeant points on the cirlce by going R units in each direction.
Once you have those two points, you can create a line and project it onto AB using some projection math. I don''t have any handy, unfortunatly.
Or, once you have the two points, you can create lines between these points and the light source respectively, and simply intersect them with AB and see where they intersect.
Once you have those two points, you can create a line and project it onto AB using some projection math. I don''t have any handy, unfortunatly.
Or, once you have the two points, you can create lines between these points and the light source respectively, and simply intersect them with AB and see where they intersect.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement