Find point on XYZ line with Distance

  • Context: Undergrad 
  • Thread starter Thread starter fallingdog
  • Start date Start date
  • Tags Tags
    Line Point
Click For Summary
SUMMARY

The discussion focuses on finding XYZ coordinates along a 3D line based on a distance parameter (M) for both the line and events. The user intends to implement this in Python and seeks guidance on calculating points along the line using M values. A suggestion is made to distinguish between M values for vertices (MV) and events (ME) to avoid confusion. Additionally, a method is provided to calculate a point at a specific distance along the line using a parametric approach.

PREREQUISITES
  • Understanding of 3D geometry and coordinate systems
  • Familiarity with Python programming
  • Knowledge of parametric equations for lines
  • Basic concepts of distance calculation in Euclidean space
NEXT STEPS
  • Implement a Python function to calculate XYZ coordinates using parametric equations
  • Explore the use of GeoPoint class for 3D point calculations in Python
  • Research how to manage and differentiate multiple distance parameters in programming
  • Learn about data structures for storing and manipulating 3D line segments and events
USEFUL FOR

Data scientists, software developers, and engineers working with 3D spatial data and event modeling in Python.

fallingdog
Messages
1
Reaction score
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
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.
 
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);
}
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 2 ·
Replies
2
Views
1K
Replies
1
Views
2K
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
17
Views
3K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 18 ·
Replies
18
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K