Beispiel #1
0
        public ulong NearestPointQuery(PointQueryContext context, cpShape shape, ulong id, object data)
        {
            if (
                !cpShapeFilter.Reject(shape.filter, context.filter)
                )
            {
                cpPointQueryInfo info = null;
                shape.PointQuery(context.point, ref info);

                if (info.shape != null && info.distance < context.maxDistance)
                {
                    context.func(shape, info.point, info.distance, info.gradient, data);
                }
            }
            return(id);
        }
Beispiel #2
0
        public ulong NearestPointQueryNearest(object ctx, cpShape shape, ulong id, ref object outp)
        {
            PointQueryContext context = (PointQueryContext)ctx;
            cpPointQueryInfo  output  = (cpPointQueryInfo)outp;

            if (
                !cpShapeFilter.Reject(shape.filter, context.filter) && !shape.sensor
                )
            {
                cpPointQueryInfo info = null;
                shape.PointQuery(context.point, ref info);

                if (info.distance < output.distance)
                {
                    outp = (object)info;
                }
            }

            return(id);
        }
Beispiel #3
0
        public ulong NearestPointQueryNearest(object ctx, cpShape shape, ulong id, ref object outp)
        {
            PointQueryContext context = (PointQueryContext)ctx;
            cpPointQueryInfo output = (cpPointQueryInfo)outp;

            if (
                !cpShapeFilter.Reject(shape.filter, context.filter) && !shape.sensor
            )
            {
                cpPointQueryInfo info = null;
                shape.PointQuery(context.point, ref info);

                if (info.distance < output.distance)
                    outp = (object)info;
            }

            return id;
        }
Beispiel #4
0
        public ulong NearestPointQuery(PointQueryContext context, cpShape shape, ulong id, object data)
        {
            if (
                !cpShapeFilter.Reject(shape.filter, context.filter)
            )
            {
                cpPointQueryInfo info = null;
                shape.PointQuery(context.point, ref info);

                if (info.shape != null && info.distance < context.maxDistance)
                    context.func(shape, info.point, info.distance, info.gradient, data);
            }
            return id;
        }