I would like to know if there is any doubt that a cone is piercing a (finite) line segment . The cone is actually a circle that has a view of theta degree area with P (X, Y) and radius r:
I'm trying to do it in C # I
- Check if the line segment is breaking through the circle,
- If this line is piercing from the segment circle, then I use a function to line segments I check every single point in
But I do not think this is the best way to do it. Does anyone have an idea?
For additional information, I need to make this function a simple visual simulator.
can help work with here, (x, y) as a point Instead of representing, you represent it as an (R, angle), where the distance from the original and angle is the angle created with a chosen axis (which corresponds to the angle 0).
If you set the angle = 0 as an angle of P (X, Y) and the angle of the cone and the polar coordinates of the end of the line segment, then say (r1, ang After the 1) and (R2, Eg2), you need the following four conditions to be correct for the line segment completely inside the cone (including the range).
r1 < = R2 and lt; = R ang1 and lt; = Theta ang2 and lt; = Theta Where r is the angle to see the radius of the cone and theta and you have chosen the axis so that the rotating counter gives the positive angle corresponding to the cloquaid.
It is easy to switch between polar and (x, y) (rectangular), and you can find it on the wiki link above.
P> We can use the polar normal form
R = p sec (ang-omega)
We gave two endpoints of the line segment According to P and Omega can be found:
We have
p = r1 * cos (AG1-Omega) = R2 * cos (angio-omega )
using cos (xy) = cos (x) * cos (y) + sin (x) * sin (y) < / Code> we get
[r1 * cos (ang1) - r2 * cos (ang2)] * cos (omega) = [r2 * sin (ang2) - r1 * sin (ex 1)] * sin (omega)
Thus you can use the tone (omega) = sin (omega) / cos (omega)
and Archda
(Inverted work of tan to get the value of oven) Once you know what omega is, you can solve for P.
Now we have to know that there are some (R, Angle) combinations on this line, such as
R & lt; = R0 and LT; = Angle & Lt; = Theta Min {Angue 1, Angus 2} and LT; = Angle & Lt; = Max {ang 1, AG 2}
(Note R is the radius cone, and theta was the angle of viewing, Ango1P1 was the angle and Ang2P2 was the angle.)
The equation can be rewritten
Rcos (ang-omega = p
Now cos (ang-omega) One is behaved very well, in which it is acted as a monotonic and you only have to interrupt it [minimum {ang1, ag2} maximum {ang1, ang2}]
To make it easier , The first must be manually able to manipulate something.
I'll leave the rest.
Comments
Post a Comment