When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For more information use !howto ask.
5 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For more information use !howto ask.
Do you know how to check wether and where two lines intersect ?
yes, i used this but i cant seem to put my thoughts to code. my first time trying C lol
you just write it down exactly like that:
float Numerator = (x1*y2 - y1*x2) * ...;
float Denominator = (x1 - x2) * (y3 - y4) - ...;
float Px = Numerator / Denominator;
you probably want to have a struct like
struct point
{
float X, Y;
};
so that you can more easily pass and return them from functions, i.e.
struct point
IntersectionPoint(struct point p1, struct point p2, struct point p3, sturct point p4)
{
...;
struct point Intersection = { .X = Px, .Y = Py };
return Intersection;
}