Beispiel #1
0
 /// <summary>
 /// Create a translation matrix.
 /// </summary>
 public static Transform CreateTranslation(Vect translate)
 {
     return(CreateTranspose(1.0, 0.0, translate.X, 0.0, 1.0, translate.Y));
 }
        private static void SpaceDebugDrawCircleCallback(Vect pos, double angle, double radius, DebugColor outlineColor, DebugColor fillColor, voidptr_t data)
        {
            IDebugDraw debugDraw = NativeInterop.FromIntPtr <IDebugDraw>(data);

            debugDraw.DrawCircle(pos, angle, radius, outlineColor, fillColor);
        }
#pragma warning restore IDE0032

        private ContactPointSet(int count, Vect normal, ContactPoint[] points)
        {
            this.count  = count;
            this.normal = normal;
            this.points = points;
        }
        private static void SpaceDebugDrawFatSegmentCallback(Vect a, Vect b, double radius, DebugColor outlineColor, DebugColor fillColor, voidptr_t data)
        {
            IDebugDraw debugDraw = NativeInterop.FromIntPtr <IDebugDraw>(data);

            debugDraw.DrawFatSegment(a, b, radius, outlineColor, fillColor);
        }
        private static void SpaceDebugDrawDotCallback(double size, Vect pos, DebugColor color, voidptr_t data)
        {
            IDebugDraw debugDraw = NativeInterop.FromIntPtr <IDebugDraw>(data);

            debugDraw.DrawDot(size, pos, color);
        }
        private static void SpaceDebugDrawSegmentCallback(Vect a, Vect b, DebugColor color, voidptr_t data)
        {
            IDebugDraw debugDraw = NativeInterop.FromIntPtr <IDebugDraw>(data);

            debugDraw.DrawSegment(a, b, color);
        }
 private ContactPoint(Vect pointA, Vect pointB, double distance)
 {
     this.pointA   = pointA;
     this.pointB   = pointB;
     this.distance = distance;
 }
Beispiel #8
0
        private static double MarchSampleFunctionCallBack(Vect point, IntPtr data)
        {
            var marchData = (MarchData)GCHandle.FromIntPtr(data).Target;

            return(marchData.SampleFunction(point, marchData.SampleData));
        }
Beispiel #9
0
        private static void MarchSegmentFunctionCallback(Vect v0, Vect v1, IntPtr data)
        {
            var marchData = (MarchData)GCHandle.FromIntPtr(data).Target;

            marchData.SegmentFunction(v0, v1, marchData.SegmentData);
        }
Beispiel #10
0
        /// <summary>
        /// Calculate the moment of inertia for a solid polygon shape assuming its center of gravity
        /// is at its centroid. The offset is added to each vertex.
        /// </summary>
        public static double MomentForPolygon(double mass, IReadOnlyList <Vect> vertices, Vect offset, double radius)
        {
            IntPtr verticesPtr = NativeInterop.StructureArrayToPtr(vertices);
            double moment      = NativeMethods.cpMomentForPoly(mass, vertices.Count, verticesPtr, offset, radius);

            NativeInterop.FreeStructure(verticesPtr);

            return(moment);
        }