コード例 #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));
 }
コード例 #2
0
        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);
        }
コード例 #3
0
#pragma warning restore IDE0032

        private ContactPointSet(int count, Vect normal, ContactPoint[] points)
        {
            this.count  = count;
            this.normal = normal;
            this.points = points;
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        private static void SpaceDebugDrawDotCallback(double size, Vect pos, DebugColor color, voidptr_t data)
        {
            IDebugDraw debugDraw = NativeInterop.FromIntPtr <IDebugDraw>(data);

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

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

            return(marchData.SampleFunction(point, marchData.SampleData));
        }
コード例 #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);
        }
コード例 #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);
        }