예제 #1
0
        public static bool InsideFov2D(FixPoint source_d1, FixPoint source_d2, FixPoint facing_d1, FixPoint facing_d2, FixPoint fov_degree, FixPoint target_d1, FixPoint target_d2)
        {
            FixPoint to_target_d1 = target_d1 - source_d1;
            FixPoint to_target_d2 = target_d2 - source_d2;
            FixPoint distance     = FixPoint.Distance(to_target_d1, to_target_d2);

            to_target_d1 /= distance;
            to_target_d2 /= distance;
            return(to_target_d1 * facing_d1 + to_target_d2 * facing_d2 >= FixPoint.Cos(FixPoint.Degree2Radian(fov_degree / FixPoint.Two)));
        }
예제 #2
0
 public FixPoint Distance(ref Vector2FP v2fp)
 {
     return(FixPoint.Distance(v2fp.x - x, v2fp.z - z));
 }
예제 #3
0
 public FixPoint Length()
 {
     return(FixPoint.Distance(x, z));
 }