コード例 #1
0
        public float SDF(Vector2 point)
        {
            float sdf = SDFUtil.SegmentSDF(point, Points[0], Points[1]);

            for (int i = 2; i < Points.Length; ++i)
            {
                float val = SDFUtil.SegmentSDF(point, Points[i], Points[i - 1]);
                sdf = Mathf.Min(sdf, val);
            }
            return(sdf);
        }
コード例 #2
0
 public float SDF(Vector2 point)
 {
     return(SDFUtil.CircleSDF(point, Position, Radius));
 }
コード例 #3
0
 public float SDF(Vector2 point)
 {
     return(SDFUtil.PolygonSDF(point, Points));
 }
コード例 #4
0
 public float SDF(Vector2 point)
 {
     return(SDFUtil.OrientedBoxSDF(point, Position, Rotation, HalfSize));
 }