intersectRayCircle

Test whether the given ray with the origin <code>(originX, originY)</code> and direction <code>(dirX, dirY)</code> intersects the given circle with center <code>(centerX, centerY)</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 circle. <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 dirX the x coordinate of the ray's direction @param dirY the y coordinate of the ray's direction @param centerX the x coordinate of the circle's center @param centerY the y coordinate of the circle's center @param radiusSquared the circle 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 circle @return <code>true</code> if the ray intersects the circle; <code>false</code> otherwise

  1. bool intersectRayCircle(double originX, double originY, double dirX, double dirY, double centerX, double centerY, double radiusSquared, Vector2d result)
    public static
    bool
    intersectRayCircle
    (
    double originX
    ,
    double originY
    ,
    double dirX
    ,
    double dirY
    ,
    double centerX
    ,
    double centerY
    ,,)
  2. bool intersectRayCircle(Vector2d origin, Vector2d dir, Vector2d center, double radiusSquared, Vector2d result)

Meta