Distance from a point along a vector to another line - math

I have seen a lot of examples with finding the closest point on a line from a point but my case is different.
This image may help explain
https://imgur.com/a/cPGkj4l
I have a point (x3,y3) and a line/vector coming from that point at theta degrees.
There is another line in space between points (x1,y1) and (x2,y2).
I need to know if the vector crosses that line and if so what is the distance between (x3,y3) and the point at which the vector crosses the line between (x1,y1) and (x2,y2).
Can anyone help here with a snippet of code?
Thanks for any help.

Related

How to find if a point is at the intersection of multiple circles?

I have a point p and multiple circles C1,C2,C3.... Cn.
How can i find if the point is at the intersection area of this Circles ?
I just know the center(x,y) and the radius of the circles C1...Cn and the coordinates of the point p(x,y).
I have to write a cpp code for implementing this problem.
But at first i need to know the logic. Please help.
Just check if the distances of the point from the three centers are less of all the three radius.
EDIT: homework? I should not have answered :/

Is the centroid of plane a point on it

I want to know if the centroid of a plane can actually be treated as a point on the plane.I have a few points on the plane from which i deduced the centroid.I would like to know if i substitute this in the plane equation will it be valid.
Thanks,
Harsha.
More of a math question. Answer will depend on which definition of centroid you want. If you define the centroid as the intersection of straight lines that divide the plane in 2 by moment, then clearly every line is in the plane so all their intersections must also be.

how to find the coordinates of the point based on distance?

I have 2 points and both are 3d points i.e A(x,y,z) and B(x,y,z).
I know the coordinates of point a and the distance between them.
How to find the coordinates of point B?
Thanks a lot
If you only know the absolute distance between the two points, you cannot find the coordinates of point B. If you think about it, knowing one point and a distance defines a sphere.
However, if you know the difference between the coordinates in the x, y, and z axes, its as simple as adding the difference to point A to obtain point B.

How to calculate the two tangent points to a circle with radius R from two lines given by three points

This is related to the arc drawn by HTML5 canvas "arcTo" function. I need to calculate the two tangent points of a circle with the radius R and two lines given by three points Q(x0,y0), P(x1,y1) and R(x2,y2).
The sketch explains the problem more. I need to find the tangent points A(xa,ya) and B(xb,yb). Note that the center of the circle is not given. Please help.
This is a question of solving a triangle with 2 known angles and one known side. Label the centre of the circle C, then the side you know is BC (or AC if you want). Angle PBC (CAP) is a right angle. The line CP bisects the angle RPQ.
Not all such triangles have a solution.

Line(s) Equidistant From Two Convex Polygons In 2D

Given two convex polygons in 2D space, how would you go about constructing the line segment(s ) which, at any point on the lines, is equidistant from the closest point of either convex polygon?
I'm looking towards an implementation of Voronoi diagrams for convex polygons instead of points, but I'm unsure how to even begin calculating the line for just two polygons. So I figured I'd take this one step at a time and start here.
Edit To try to make the question a little clearer, I want to bisect the plane (or a subset thereof).
Suppose we have polygon A on the left and polygon B on the right. There will be some line of bisection that divides the plane into points on the left and points on the right. Every point on the line is equally distance from either polygon. Every point left of the line is closer to polygon A than to polygon B. Every point right of the line is closest to polygon B.
Here's an image generated by a Matlab script I wrote that brute-forces an approximation:
The problem, I believe, is not as simple as examining the space in "between" the two polygons, since the line must extend beyond the area directly between the two shapes. And ideally I'd like to find a solution that generalizes to more than two shapes, which, to me, seems to complicate the problem a great deal more. Here's a (obviously very rough) approximation of how that might look:
Well, proceeding one step at a time I'd look at the closest points in the polygons themselves. Let's say a in A is the closest point to B and b in B is the closest point to A. You know the middle point of AB is in the desired segments.
What are the posibilities for a? It can be a vertex of A or it can be a point in one side. The same applies for b. What happens with the "equidistant-segments"? How to build them in each case?
Since those segments are equidistant to sides of the polygons, they have to be part of the line that bissects the angle of the lines containing the corresponding sides.
Am I understanding you correctly but assuming you're wanting the line that effectively bisects the space between 2 convex polygons? If so, then ...
find the line that joins the 2 polygons (P1 & P2)
find each polygon centre (P1.centre & P2.centre) by calculating the average X and Y coordinate.
find the vertex on each polygon that's closest to the other's centre (P1.vc & P2.vc)
given that P1.vc & P2.vc now define the line joining P1 & P2
find the midpoint (mp) of P1.vc & P2.vc
Bisecting line = perpendicular of the line joining P1.vc & P2.vc that passes through mp

Resources