Пример #1
0
 public Geometry(
     IShape shape,
     CommonGeometry baseGeometry,
     ObjectGeometryType geometryType)
     : this(shape, baseGeometry, geometryType, false)
 {
 }
Пример #2
0
        private IGeometry[] GetShapesGeometry(
            List <Vector3d[]> inputVertexPosition,
            List <int[][]> inputTriangle)
        {
            IGeometry[]     geometry    = new IGeometry[inputVertexPosition.Count];
            List <Vector3d> verticesSum = new List <Vector3d>();

            for (int i = 0; i < inputVertexPosition.Count; i++)
            {
                TriangleMesh[] triangleMeshes = CommonUtilities.GetTriangleMeshes(inputTriangle[i]);

                var idx = new int[inputVertexPosition[i].Length];

                for (int j = 0; j < inputVertexPosition[i].Length; j++)
                {
                    idx[j] = verticesSum.Count + j;
                }

                var baseGeometry = new CommonGeometry(inputVertexPosition[i], triangleMeshes, idx);

                geometry[i] = new Geometry(this, baseGeometry, ObjectGeometryType.ConvexShape, true);

                verticesSum.AddRange(inputVertexPosition[i].ToList());
            }

            //TODO
            //Vertices = verticesSum.ToArray();

            SetGeometry();

            return(geometry);
        }
Пример #3
0
 public Geometry(
     IShape shape,
     CommonGeometry baseGeometry,
     ObjectGeometryType geometryType,
     bool getAdjacencyList)
 {
     Shape        = shape;
     GeometryType = geometryType;
     BaseGeometry = baseGeometry;
 }
Пример #4
0
        public ConvexShape(
            CommonGeometry baseGeometry,
            Vector3d position,
            double mass,
            bool isStatic) : base()
        {
            ObjectType = ObjectType.RigidBody;

            ObjectGeometry = new Geometry(
                this,
                baseGeometry,
                ObjectGeometryType.ConvexShape,
                true);

            SetIsStatic(isStatic);
            SetMass(mass);
            SetPosition(position);
            ShapeInit();
        }
Пример #5
0
        public ConcaveShape(
            CommonGeometry baseGeometry,
            Vector3d position,
            double mass,
            bool isStatic) : base()
        {
            ObjectType = ObjectType.RigidBody;
            SetIsStatic(isStatic);

            Position = position;

            ObjectGeometry = new Geometry(
                this,
                baseGeometry,
                ObjectGeometryType.ConcaveShape,
                true);

            SetRotationMatrix();
            SetMass(mass);

            SetShapeGeometry();
            SetRelativePosition();
            SetAABB();
        }