intersectRaySphere

Test whether the given ray with the origin <code>(originX, originY, originZ)</code> and normalized direction <code>(dirX, dirY, dirZ)</code> intersects the given sphere with center <code>(centerX, centerY, centerZ)</code> and square radius <code>radiusSquared</code>, and store the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near and far) of intersections into the given <code>result</code> vector. <p> This method returns <code>true</code> for a ray whose origin lies inside the sphere. <p> Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a>

@param originX the x coordinate of the ray's origin @param originY the y coordinate of the ray's origin @param originZ the z coordinate of the ray's origin @param dirX the x coordinate of the ray's normalized direction @param dirY the y coordinate of the ray's normalized direction @param dirZ the z coordinate of the ray's normalized direction @param centerX the x coordinate of the sphere's center @param centerY the y coordinate of the sphere's center @param centerZ the z coordinate of the sphere's center @param radiusSquared the sphere radius squared @param result a vector that will contain the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near, far) of intersections with the sphere @return <code>true</code> if the ray intersects the sphere; <code>false</code> otherwise

  1. bool intersectRaySphere(double originX, double originY, double originZ, double dirX, double dirY, double dirZ, double centerX, double centerY, double centerZ, double radiusSquared, Vector2d result)
    public static
    bool
    intersectRaySphere
    (
    double originX
    ,
    double originY
    ,
    double originZ
    ,
    double dirX
    ,
    double dirY
    ,
    double dirZ
    ,
    double centerX
    ,
    double centerY
    ,
    double centerZ
    ,,)
  2. bool intersectRaySphere(Vector3d origin, Vector3d dir, Vector3d center, double radiusSquared, Vector2d result)

Meta