Ray.Point C# (CSharp) Method

Point() public method

public Point ( float dist ) : Vector3
dist float
return Vector3
  public Vector3 Point (float dist) {
    return this.origin.Add(this.direction.Mul(dist));
  }
}

Usage Example

示例#1
0
文件: csrb.cs 项目: rsayers/raybench
    public Hit Hit(Ray ray)
    {
        var   oc  = ray.origin - center;
        float a   = Vector3.Dot(ray.direction, ray.direction);
        float b   = Vector3.Dot(oc, ray.direction);
        float c   = Vector3.Dot(oc, oc) - radius * radius;
        float dis = b * b - a * c;

        if (dis > 0)
        {
            float e = (float)Math.Sqrt(dis);

            float t = (-b - e) / a;
            if (t > 0.007f)
            {
                var point = ray.Point(t);
                return(new Hit(t, point, (point - center).Unit()));
            }

            t = (-b + e) / a;
            if (t > 0.007f)
            {
                var point = ray.Point(t);
                return(new Hit(t, point, (point - center).Unit()));
            }

            return(default);
All Usage Examples Of Ray::Point