public cpShape SegmentQueryFirst(cpVect start, cpVect end, float radius, cpShapeFilter filter, ref cpSegmentQueryInfo output) { cpSegmentQueryInfo info = new cpSegmentQueryInfo(null, end, cpVect.Zero, 1.0f); if (output == null) { output = info; } SegmentQueryContext context = new SegmentQueryContext( start, end, radius, filter, null); this.staticShapes.SegmentQuery(context, start, end, 1.0f, (o1, o2, o3) => SegmentQueryFirstFunc((SegmentQueryContext)o1, o2 as cpShape, (cpSegmentQueryInfo)o3) , output); // this.dynamicShapes.SegmentQuery(context, start, end, output.alpha , SegmentQueryFirst, ref output); this.dynamicShapes.SegmentQuery(context, start, end, output.alpha, (o1, o2, o3) => SegmentQueryFirstFunc((SegmentQueryContext)o1, o2 as cpShape, (cpSegmentQueryInfo)o3) , output); return(output.shape); }
//MARK: Segment Query Functions public float SegmentQueryFunc(SegmentQueryContext context, cpShape shape, object data) { cpSegmentQueryInfo info = null; if ( !cpShapeFilter.Reject(shape.filter, context.filter) && shape.SegmentQuery(context.start, context.end, context.radius, ref info) ) { context.func(shape, info.point, info.normal, info.alpha, data); } return(1.0f); }
public float SegmentQueryFirstFunc(SegmentQueryContext context, cpShape shape, cpSegmentQueryInfo output) { cpSegmentQueryInfo info = null; if ( !cpShapeFilter.Reject(shape.filter, context.filter) && !shape.sensor && shape.SegmentQuery(context.start, context.end, context.radius, ref info) && info.alpha < output.alpha ) { output = info; } return(output.alpha); }
public void SegmentQuery(cpVect start, cpVect end, float radius, cpShapeFilter filter, Action <cpShape, cpVect, cpVect, float, object> func, object data) { SegmentQueryContext context = new SegmentQueryContext( start, end, radius, filter, func ); Lock(); { this.staticShapes.SegmentQuery(context, start, end, 1.0f, (o1, o2, o3) => SegmentQueryFunc((SegmentQueryContext)o1, o2 as cpShape, o3) , data); this.dynamicShapes.SegmentQuery(context, start, end, 1.0f, (o1, o2, o3) => SegmentQueryFunc((SegmentQueryContext)o1, o2 as cpShape, o3) , data); } Unlock(true); }
//MARK: Segment Query Functions public float SegmentQueryFunc(SegmentQueryContext context, cpShape shape, object data) { cpSegmentQueryInfo info = null; if ( !cpShapeFilter.Reject(shape.filter, context.filter) && shape.SegmentQuery(context.start, context.end, context.radius, ref info) ) { context.func(shape, info.point, info.normal, info.alpha, data); } return 1.0f; }
public float SegmentQueryFirstFunc(SegmentQueryContext context, cpShape shape, cpSegmentQueryInfo output) { cpSegmentQueryInfo info = null; if ( !cpShapeFilter.Reject(shape.filter, context.filter) && !shape.sensor && shape.SegmentQuery(context.start, context.end, context.radius, ref info) && info.alpha < output.alpha ) { output = info; } return output.alpha; }
public cpShape SegmentQueryFirst(cpVect start, cpVect end, float radius, cpShapeFilter filter, ref cpSegmentQueryInfo output) { cpSegmentQueryInfo info = new cpSegmentQueryInfo(null, end, cpVect.Zero, 1.0f); if (output == null) output = info; SegmentQueryContext context = new SegmentQueryContext( start, end, radius, filter, null); this.staticShapes.SegmentQuery(context, start, end, 1.0f, (o1, o2, o3) => SegmentQueryFirstFunc((SegmentQueryContext)o1, o2 as cpShape, (cpSegmentQueryInfo)o3) , output); // this.dynamicShapes.SegmentQuery(context, start, end, output.alpha , SegmentQueryFirst, ref output); this.dynamicShapes.SegmentQuery(context, start, end, output.alpha, (o1, o2, o3) => SegmentQueryFirstFunc((SegmentQueryContext)o1, o2 as cpShape, (cpSegmentQueryInfo)o3) , output); return output.shape; }
public void SegmentQuery(cpVect start, cpVect end, float radius, cpShapeFilter filter, Action<cpShape, cpVect, cpVect, float, object> func, object data) { SegmentQueryContext context = new SegmentQueryContext( start, end, radius, filter, func ); Lock(); { this.staticShapes.SegmentQuery(context, start, end, 1.0f, (o1, o2, o3) => SegmentQueryFunc((SegmentQueryContext)o1, o2 as cpShape, o3) , data); this.dynamicShapes.SegmentQuery(context, start, end, 1.0f, (o1, o2, o3) => SegmentQueryFunc((SegmentQueryContext)o1, o2 as cpShape, o3) , data); } Unlock(true); }