Note that there are some explanatory texts on larger screens.

plurals
  1. POIntersection of a line and a Sphere?
    primarykey
    data
    text
    <p>I have a simple object that allows you to assign three properties (x,y,z) (lets call this object a "point", because that is what it is). I then have a second object with a method that accepts two instances of the first object, and returns the distance between the two "points" in three dimensional space. I also need a method that will accept two "points" and a double, representing distance traveled (from the first "point" parameter used) that returns a "point" object with its x,y,z coordinates.</p> <p>I'm ok with everything except the calculation of the point coordinates that are on the original line between the two points supplied, that is at a certain distance from the first point.</p> <p>"point" object:</p> <pre><code>public class POR { private double PORX; private double PORY; private double PORZ; public double X { get { return PORX; } set { PORX = value; } } public double Y { get { return PORY; } set { PORY = value; } } public double Z { get { return PORZ; } set { PORZ = value; } } public POR(double X, double Y, double Z) { PORX = X; PORY = Y; PORZ = Z; } </code></pre> <p>I'm then using : </p> <pre><code> public double PorDistance(POR por1, POR por2) { return Math.Round(Math.Sqrt( Math.Pow((por1.X - por2.X),2) + Math.Pow((por1.Y - por2.Y),2) + Math.Pow((por1.Z - por2.Z),2)),2); } </code></pre> <p>to return the distance between those two points I need something like</p> <pre><code>public POR IntersectPOR (POR por1, POR por2, double distance) { } </code></pre> <p>where distance is the distance traveled from por1 towards por2.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload