Find point on XYZ line with Distance

  • Thread starter fallingdog
  • Start date
  • Tags
    Line Point
In summary, the conversation discusses finding the XYZ values for the vertexes of a new line, given a line represented in 3D space with XYZ coordinates and a distance (M) value for the start point. The plan is to use python and the provided pseudo code to iterate through the M values and find the points on the line between vertexes. The distance between points can be calculated with the provided formula, but it is unclear how to find the event points with just the M value. Clarification is needed on whether the event line segments lie along the main line or radiate out in another direction.
  • #1
fallingdog
1
0
The situation: I have a line represented in 3D space with XYZ coordinates. The line also has a M value for the distance from the start point in 3D. I have another data set that has "events" that I would like to find on my line. They have a distance (M) for the start and stop of the event; therefore, each event will be a line. So, I need to find all of the XYZ values for the vertexes of this new line. I plan on using python for the task.

What I am thinking is -- in pseudo code is:

for each M value in the line starting from 0:
if the M of the event is more then the M of the vertex:
move to the next vert
else:
find the point on the line between vertexes​

add vertexes to my new event line as needed​

So, I can find the distance between points no problem with:

d = ((x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2)^(1/2)

But I am not sure how to find the event points with just the M along the line. Can someone please point me to the right path?

Thanks for any help!
 
Mathematics news on Phys.org
  • #2
fallingdog said:
The situation: I have a line represented in 3D space with XYZ coordinates. The line also has a M value for the distance from the start point in 3D. I have another data set that has "events" that I would like to find on my line. They have a distance (M) for the start and stop of the event; therefore, each event will be a line. So, I need to find all of the XYZ values for the vertexes of this new line. I plan on using python for the task.

What I am thinking is -- in pseudo code is:

for each M value in the line starting from 0:
if the M of the event is more then the M of the vertex:
move to the next vert
else:
find the point on the line between vertexes
add vertexes to my new event line as needed​

So, I can find the distance between points no problem with:

d = ((x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2)^(1/2)

But I am not sure how to find the event points with just the M along the line. Can someone please point me to the right path?

Thanks for any help!
Your question isn't very clearly stated. For the line in space, do you know the coordinates of the vertices? If you know a given vertex, the distance from the starting point, which you're calling M, can be calculated fairly easily.

Using "M" for both the vertex (i.e., point on the line) and for the event is confusing. It would be better to use a different variable for these, or maybe include a subscript to distinguish M for a vertex (say, MV) from M for an event (say, ME).

You say "each event will be a line." Actually, each event is represented by a line segment. Do these event line segments lie along the line or do they radiate out in some other direction? If they are along the main line, you could write the line in parametric form in terms of a direction vector. Starting from a given point on the line, you could calculate the coordinates of another point at the end of a line segment of known length.
 
  • #3
public GeoPoint GetPointAt3D(double distance3D)
{
double distanceLengthRatio = distance3D / this.Length3D;
double x = this.FromPoint.X + ((this.ToPoint.X - this.FromPoint.X) * distanceLengthRatio);
double y = this.FromPoint.Y + ((this.ToPoint.Y - this.FromPoint.Y) * distanceLengthRatio);
double z = this.FromPoint.Z + ((this.ToPoint.Z - this.FromPoint.Z) * distanceLengthRatio);

return new GeoPoint(this.WKID, x, y, z);
}
 

1. How do I find a point on a XYZ line with a given distance?

To find a point on a XYZ line with a given distance, you will need to know the coordinates of at least two points on the line and the distance from one of those points to the desired point. Using this information, you can use the distance formula to calculate the coordinates of the desired point.

2. What is the distance formula for finding a point on a XYZ line?

The distance formula for finding a point on a XYZ line is:
D = √[(x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2]
Where (x1, y1, z1) and (x2, y2, z2) are the coordinates of two points on the line and D is the distance between them.

3. Can I find a point on a XYZ line without knowing the coordinates of any points on the line?

No, in order to find a point on a XYZ line with a given distance, you will need to know the coordinates of at least two points on the line. This is necessary to use the distance formula and calculate the coordinates of the desired point.

4. What happens if the distance given is greater than the length of the line?

If the distance given is greater than the length of the line, it means that the desired point is not on the line. In this case, it is not possible to find a point on the line with the given distance.

5. Can I find multiple points on a XYZ line with the same distance?

Yes, it is possible to find multiple points on a XYZ line with the same distance. As long as you have the coordinates of at least two points on the line and the desired distance, you can use the distance formula to calculate the coordinates of any number of points on the line.

Similar threads

  • General Math
Replies
3
Views
873
Replies
2
Views
286
Replies
10
Views
2K
Replies
2
Views
2K
  • Precalculus Mathematics Homework Help
Replies
7
Views
874
  • General Math
Replies
4
Views
1K
  • Precalculus Mathematics Homework Help
Replies
17
Views
985
Replies
7
Views
2K
  • General Math
Replies
1
Views
698
Back
Top