static public bool IsIntersectingLine(this Face item, Ray2 ray, out float distance, out Vector2 point) { bool did_intersect = ray.IsIntersectingLine(item.v0, item.normal, out distance); point = ray.GetPointAlong(distance); return(did_intersect && point.IsBoundBetween(item.v0, item.v1)); }
static public bool IsIntersecting(this Plane2 item, Ray2 ray, out Vector2 point) { float distance; bool did_intersect = item.IsIntersecting(ray, out distance); point = ray.GetPointAlong(distance); return(did_intersect); }
static public bool IsIntersecting(this Plane2 item, Ray2 ray, out float distance) { if (item.IsIntersectingLine(ray, out distance) && distance >= 0.0f) { return(true); } return(false); }
static public bool CircleCast(this Ray2 item, float radius, out RaycastHit2D hit, float max_distance = float.PositiveInfinity, int layer_mask = IntBits.ALL_BITS) { hit = Physics2D.CircleCast(item.origin, radius, item.direction, max_distance, layer_mask); if (hit.DidHit()) { return(true); } return(false); }
static public bool Cast(this Ray2 item, out RaycastHit2D hit, float max_distance = float.PositiveInfinity, int layer_mask = IntBits.ALL_BITS) { hit = item.CastGetHit(max_distance, layer_mask); if (hit.DidHit()) { return(true); } return(false); }
static public bool IsIntersecting(this Face item, Ray2 ray, out float distance, out Vector2 point) { if (item.IsIntersectingLine(ray, out distance, out point) && distance >= 0.0f) { return(true); } distance = float.MaxValue; return(false); }
static public bool IsIntersectingLine(this Ray2 item, Vector2 point, Vector2 normal, out float offset) { float ray_normal_length = -normal.GetDot(item.direction); float normal_distance = normal.GetDot(item.origin - point); offset = normal_distance / ray_normal_length; if (offset > float.MinValue && offset < float.MaxValue) { return(true); } return(false); }
static public bool IsIntersectingLine(this Face item, Ray2 ray, out float distance) { Vector2 point; return(item.IsIntersectingLine(ray, out distance, out point)); }
static public Vector2 GetPointAlong(this Ray2 item, float distance) { return(item.origin + item.direction * distance); }
static public void DrawRay(Ray2 ray) { DrawRay(ray, 0.3f); }
static public IEnumerable <RaycastHit2D> CircleCastGetAllHits(this Ray2 item, float radius, float max_distance = float.PositiveInfinity, int layer_mask = IntBits.ALL_BITS) { return(Physics2DExtensions.CircleCastAll(item.origin, item.direction, radius, max_distance, layer_mask)); }
static public RaycastHit2D CircleCastGetHit(this Ray2 item, float radius, float max_distance = float.PositiveInfinity, int layer_mask = IntBits.ALL_BITS) { return(Physics2D.CircleCast(item.origin, radius, item.direction, max_distance, layer_mask)); }
static public bool CircleCast(this Ray2 item, float radius, float max_distance = float.PositiveInfinity, int layer_mask = IntBits.ALL_BITS) { RaycastHit2D hit; return(item.CircleCast(radius, out hit, max_distance, layer_mask)); }
static public float FindLargestFixedEdgeCircleCast(this Ray2 item, float distance, float maximum, int layer_mask = IntBits.ALL_BITS, float margin = Mathq.DEFAULT_SOLVE_MARGIN, int max_iterations = Mathq.DEFAULT_SOLVE_MAX_NUMBER_ITERATIONS) { return(Physics2DExtensions.FindLargestFixedEdgeCircleCast(item.origin, item.direction, distance, maximum, layer_mask, margin, max_iterations)); }
static public bool IsIntersectingLine(this Plane2 item, Ray2 ray, out float distance) { return(ray.IsIntersectingLine(item.GetOrigin(), item.normal, out distance)); }
static public bool IsIntersecting(this Face item, Ray2 ray, out Vector2 point) { float distance; return(item.IsIntersecting(ray, out distance, out point)); }
static public void DrawRay(Ray2 ray, float size) { DrawVectorArrow(ray.origin, ray.direction, size); }