Point At Given Distance in 3d Space

In summary, the conversation discusses the problem of finding a 3D point on a given line, starting from a specific point, and with a given direction and distance. The direction is described using spherical coordinates, and the distance can range from 1 to 100. An algorithm is needed to find the 3D point, and the document provided may be helpful in solving this problem using Cartesian, Vector, or Parameter Forms of 3D Equations for Lines and Planes.
  • #1
Sothh
11
0
I am working on a simple ray tracer for rending point clouds in real time.

I am not so good with maths, and I am stuck with a fairly simple problem:

Given a start point (0,0,0) and a direction (0,90) and a distance 1-100, how do I get the 3d point the line will hit?

As this will go directly into code, it will be easier for me to use if no special math characters are used. (And easier for me to understand :)

Thanks!
 
Mathematics news on Phys.org
  • #2
You have the origin in three dimensions, but I am not sure what "direction(0, 90)" means. Is that in "spherical coordinates" with [itex]\theta] (the "longitude") equal to 0 and [itex]\phi[/itex] (the "co-latitude") so that is directed toward the positive x- axis? But then what "third point" are you talking about? You have only mentioned one point, the origin. And what do you mean by "a distance 1-100"? A distance is a single number.

If you mean "the point at distance 1 from the origin in the direction of the positive x-axis", that is, of course, (1, 0, 0). If you mean the point at distance 100 from the origin in that direction, that is (100, 0, 0). If you mean some point at distance x, where x is between 1 and 100, from the origin in that direction, that is (x, 0, 0).
 
  • #3
Sorry, the direction is the longitude and latitude, or pitch and yaw.

1-100 is a single number, that may range between 1 to 100 (or more.)

I need the algorithm to find the 3d point that the line ends at when given a starting point, a direction, and a distance from the starting point.
 
  • #4
This document might help if you can work in Cartesian, Vector, or Parameter Forms of 3D Equations for Lines and Planes
https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0B8eDe0O_ATL_NjRjZDViOWUtZjk4NS00OTQyLThkODUtNDEzOWUzNTFhMmQ4&hl=en_US [Broken]
 
Last edited by a moderator:
  • #5


Hello,

Thank you for your question. I understand that working with 3D space can be challenging, especially when it comes to visualization and calculations. In order to solve your problem, we can use some basic principles from geometry and linear algebra.

First, let's define the start point as (x0, y0, z0) and the direction as (θx, θy, θz), where θx and θy represent the angles in the x and y directions, respectively. We can use these values to create a vector representing the direction, which we will call d.

d = (cos(θx), cos(θy), cos(θz))

Next, we need to find the point that the line will hit, which we will call P. We can use the distance given (d) to determine the magnitude of the vector d and scale it accordingly. This can be done using the following formula:

P = (x0 + d*dx, y0 + d*dy, z0 + d*dz)

where dx, dy, and dz represent the components of the vector d.

Finally, we can use this formula to calculate the coordinates of the point that the line will hit at the given distance. Keep in mind that this formula assumes the line is starting at the origin (0,0,0). If your start point is different, you will need to adjust the formula accordingly.

I hope this helps you with your ray tracer project. If you have any further questions, please don't hesitate to reach out. Good luck with your project!

Best,
 

1. What is the equation for calculating the point at a given distance in 3D space?

The equation for calculating the point at a given distance in 3D space is: P = P0 + d * (V/|V|), where P0 is the starting point, d is the given distance, and V is the direction vector.

2. How do you determine the direction vector for calculating the point in 3D space?

The direction vector can be determined by subtracting the coordinates of the starting point from the coordinates of the desired point. This will give you the vector that points from the starting point to the desired point.

3. Can this equation be used for any point in 3D space?

Yes, this equation can be used for any point in 3D space as long as you have the starting point, the given distance, and the direction vector.

4. Are there any limitations to using this equation for calculating points in 3D space?

One limitation is that the given distance must be positive. Additionally, this equation assumes that the given distance is measured in a straight line from the starting point to the desired point.

5. How is the distance between two points in 3D space calculated?

The distance between two points in 3D space can be calculated using the distance formula, which is: d = √((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2), where (x1, y1, z1) and (x2, y2, z2) are the coordinates of the two points.

Similar threads

  • General Math
Replies
3
Views
2K
Replies
4
Views
492
Replies
13
Views
1K
  • Precalculus Mathematics Homework Help
Replies
17
Views
877
Replies
5
Views
2K
Replies
2
Views
2K
  • General Math
Replies
4
Views
3K
Replies
6
Views
807
Replies
16
Views
3K
Replies
1
Views
729
Back
Top