protected bool Equals(MyTransformMatrix other)
        {
            var tolerance = Math.Pow(10, -6);
            var okMatrix  = true;

            for (var i = 0; i < 3; i++)
            {
                double[] firstVector =
                {
                    this.RotationMatrix[i, 0],
                    this.RotationMatrix[i, 1],
                    this.RotationMatrix[i, 2]
                };
                double[] secondVector =
                {
                    other.RotationMatrix[i, 0],
                    other.RotationMatrix[i, 1],
                    other.RotationMatrix[i, 2]
                };
                if (okMatrix == true)
                {
                    okMatrix = FunctionsLC.MyEqualsArray(firstVector, secondVector);
                }
                //KLdebug.Print("okMatrix" + okMatrix, "prova.txt");
            }

            return(okMatrix && FunctionsLC.MyEqualsArray(TranslationVector, other.TranslationVector) && (Math.Abs(ScaleFactor - other.ScaleFactor) < tolerance));
        }
        //This function, once applied to a MyTransformMatrix, composes it with another given one.
        public MyTransformMatrix ComposeTwoTransformMatrix(MyTransformMatrix other, SldWorks swApplication)
        {
            var outputMyTransformMatrix = new MyTransformMatrix();

            if (other == null)
            {
                swApplication.SendMsgToUser("ERROR. Found null MyTransformMatrix.");
                return(outputMyTransformMatrix);
            }
            var outputRotMatrix   = this.RotationMatrix.Multiply(other.RotationMatrix);
            var outputTransVector = this.TranslationVector.Add(other.TranslationVector);
            var outputScaleFactor = this.ScaleFactor * other.ScaleFactor;

            outputMyTransformMatrix = new MyTransformMatrix(outputRotMatrix, outputTransVector, outputScaleFactor);
            return(outputMyTransformMatrix);
        }
예제 #3
0
        public MyRepeatedComponent(Component2 component, int idCorrespondingNode, MyTransformMatrix transform, bool isLeaf, MyRepeatedEntity repeatedEntity)
        {
            this.Component      = component;
            Name                = component.Name2;
            IdCorrespondingNode = idCorrespondingNode;
            this.Transform      = transform;
            this.IsLeaf         = isLeaf;

            var originVertex = new MyVertex(transform.TranslationVector[0], transform.TranslationVector[1],
                                            transform.TranslationVector[2]);


            this.Origin    = originVertex;
            RepeatedEntity = repeatedEntity;

            IsSphere = false;
        }
예제 #4
0
        public MyRepeatedComponent(Component2 component, MyTransformMatrix transform, bool isLeaf, MyRepeatedEntity repeatedEntity)
        {
            this.Component = component;
            var pathComponent = component.Name2;
            var componentName = pathComponent.Split('/').Last();

            Name           = componentName;
            this.Transform = transform;
            this.IsLeaf    = isLeaf;

            var originVertex = new MyVertex(transform.TranslationVector[0], transform.TranslationVector[1],
                                            transform.TranslationVector[2]);


            this.Origin    = originVertex;
            RepeatedEntity = repeatedEntity;

            IsSphere = false;
        }