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))); }
public FixPoint Distance(ref Vector2FP v2fp) { return(FixPoint.Distance(v2fp.x - x, v2fp.z - z)); }
public FixPoint Length() { return(FixPoint.Distance(x, z)); }