intersectRayCircle

Test whether the ray with the given <code>origin</code> and direction <code>dir</code> intersects the circle with the given <code>center</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 origin the ray's origin @param dir the ray's direction @param center 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)
  2. bool intersectRayCircle(Vector2d origin, Vector2d dir, Vector2d center, double radiusSquared, Vector2d result)
    static
    bool
    intersectRayCircle

Meta