Exemplo n.º 1
0
 internal override void ApplyTransformation(com.epl.geometry.Transformation3D transform)
 {
     if (IsEmpty())
     {
         return;
     }
     _verifyAllStreams();
     AddAttribute(com.epl.geometry.VertexDescription.Semantics.Z);
     _verifyAllStreams();
     com.epl.geometry.AttributeStreamOfDbl points = (com.epl.geometry.AttributeStreamOfDbl)m_vertexAttributes[0];
     com.epl.geometry.AttributeStreamOfDbl zs     = (com.epl.geometry.AttributeStreamOfDbl)m_vertexAttributes[1];
     com.epl.geometry.Point3D pt3 = new com.epl.geometry.Point3D();
     for (int ipoint = 0; ipoint < m_pointCount; ipoint++)
     {
         pt3.x = points.Read(ipoint * 2);
         pt3.y = points.Read(ipoint * 2 + 1);
         pt3.z = zs.Read(ipoint);
         com.epl.geometry.Point3D res = transform.Transform(pt3);
         points.Write(ipoint * 2, res.x);
         points.Write(ipoint * 2 + 1, res.y);
         zs.Write(ipoint, res.z);
     }
     // REFACTOR: reset the exact envelope only and transform the loose
     // envelope
     NotifyModified(com.epl.geometry.MultiVertexGeometryImpl.DirtyFlags.DirtyCoordinates);
 }
Exemplo n.º 2
0
 internal override void ApplyTransformation(com.epl.geometry.Transformation3D transform)
 {
     if (IsEmptyImpl())
     {
         return;
     }
     AddAttribute(com.epl.geometry.VertexDescription.Semantics.Z);
     com.epl.geometry.Point3D pt = GetXYZ();
     SetXYZ(transform.Transform(pt));
 }
        /// <summary>Calculates the Inverse transformation.</summary>
        /// <param name="src">The input transformation.</param>
        /// <param name="result">
        /// The inverse of the input transformation. Throws the
        /// GeometryException("math singularity") exception if the Inverse
        /// can not be calculated.
        /// </param>
        public static void Inverse(com.epl.geometry.Transformation3D src, com.epl.geometry.Transformation3D result)
        {
            double det = src.xx * (src.yy * src.zz - src.zy * src.yz) - src.yx * (src.xy * src.zz - src.zy * src.xz) + src.zx * (src.xy * src.yz - src.yy * src.xz);

            if (det != 0)
            {
                double xx;
                double yx;
                double zx;
                double xy;
                double yy;
                double zy;
                double xz;
                double yz;
                double zz;
                double xd;
                double yd;
                double zd;
                double det_1 = 1.0 / det;
                xx        = (src.yy * src.zz - src.zy * src.yz) * det_1;
                xy        = -(src.xy * src.zz - src.zy * src.xz) * det_1;
                xz        = (src.xy * src.yz - src.yy * src.xz) * det_1;
                yx        = -(src.yx * src.zz - src.yz * src.zx) * det_1;
                yy        = (src.xx * src.zz - src.zx * src.xz) * det_1;
                yz        = -(src.xx * src.yz - src.yx * src.xz) * det_1;
                zx        = (src.yx * src.zy - src.zx * src.yy) * det_1;
                zy        = -(src.xx * src.zy - src.zx * src.xy) * det_1;
                zz        = (src.xx * src.yy - src.yx * src.xy) * det_1;
                xd        = -(src.xd * xx + src.yd * xy + src.zd * xz);
                yd        = -(src.xd * yx + src.yd * yy + src.zd * yz);
                zd        = -(src.xd * zx + src.yd * zy + src.zd * zz);
                result.xx = xx;
                result.yx = yx;
                result.zx = zx;
                result.xy = xy;
                result.yy = yy;
                result.zy = zy;
                result.xz = xz;
                result.yz = yz;
                result.zz = zz;
                result.xd = xd;
                result.yd = yd;
                result.zd = zd;
            }
            else
            {
                throw new com.epl.geometry.GeometryException("math singularity");
            }
        }
 public com.epl.geometry.Transformation3D Copy()
 {
     com.epl.geometry.Transformation3D result = new com.epl.geometry.Transformation3D();
     result.xx = xx;
     result.yx = yx;
     result.zx = zx;
     result.xy = xy;
     result.yy = yy;
     result.zy = zy;
     result.xz = xz;
     result.yz = yz;
     result.zz = zz;
     result.xd = xd;
     result.yd = yd;
     result.zd = zd;
     return(result);
 }
Exemplo n.º 5
0
 internal override void ApplyTransformation(com.epl.geometry.Transformation3D transform)
 {
     _touch();
     com.epl.geometry.Point3D pt = new com.epl.geometry.Point3D();
     pt.x     = m_xStart;
     pt.y     = m_yStart;
     pt.z     = _getAttributeAsDbl(0, com.epl.geometry.VertexDescription.Semantics.Z, 0);
     pt       = transform.Transform(pt);
     m_xStart = pt.x;
     m_yStart = pt.y;
     _setAttribute(0, com.epl.geometry.VertexDescription.Semantics.Z, 0, pt.z);
     pt.x   = m_xEnd;
     pt.y   = m_yEnd;
     pt.z   = _getAttributeAsDbl(1, com.epl.geometry.VertexDescription.Semantics.Z, 0);
     pt     = transform.Transform(pt);
     m_xEnd = pt.x;
     m_yEnd = pt.y;
     _setAttribute(1, com.epl.geometry.VertexDescription.Semantics.Z, 0, pt.z);
 }
        /// <summary>
        /// Performs multiplication of matrices a and b and places result into
        /// result.
        /// </summary>
        /// <remarks>
        /// Performs multiplication of matrices a and b and places result into
        /// result. The a, b, and result could point to same objects. <br />
        /// Equivalent to result = a * b.
        /// </remarks>
        public static void Multiply(com.epl.geometry.Transformation3D a, com.epl.geometry.Transformation3D b, com.epl.geometry.Transformation3D result)
        {
            // static
            double xx;
            double yx;
            double zx;
            double xy;
            double yy;
            double zy;
            double xz;
            double yz;
            double zz;
            double xd;
            double yd;
            double zd;

            xx        = a.xx * b.xx + a.yx * b.xy + a.zx * b.xz;
            yx        = a.xx * b.yx + a.yx * b.yy + a.zx * b.yz;
            zx        = a.xx * b.zx + a.yx * b.zy + a.zx * b.zz;
            xy        = a.xy * b.xx + a.yy * b.xy + a.zy * b.xz;
            yy        = a.xy * b.yx + a.yy * b.yy + a.zy * b.yz;
            zy        = a.xy * b.zx + a.yy * b.zy + a.zy * b.zz;
            xz        = a.xz * b.xx + a.yz * b.xy + a.zz * b.xz;
            yz        = a.xz * b.yx + a.yz * b.yy + a.zz * b.yz;
            zz        = a.xz * b.zx + a.yz * b.zy + a.zz * b.zz;
            xd        = a.xd * b.xx + a.yd * b.xy + a.zd * b.xz + b.xd;
            yd        = a.xd * b.yx + a.yd * b.yy + a.zd * b.yz + b.yd;
            zd        = a.xd * b.zx + a.yd * b.zy + a.zd * b.zz + b.zd;
            result.xx = xx;
            result.yx = yx;
            result.zx = zx;
            result.xy = xy;
            result.yy = yy;
            result.zy = zy;
            result.xz = xz;
            result.yz = yz;
            result.zz = zz;
            result.xd = xd;
            result.yd = yd;
            result.zd = zd;
        }
Exemplo n.º 7
0
 internal override void ApplyTransformation(com.epl.geometry.Transformation3D transform)
 {
     _touch();
     if (!m_envelope.IsEmpty())
     {
         com.epl.geometry.Envelope3D env = new com.epl.geometry.Envelope3D();
         QueryEnvelope3D(env);
         if (env.IsEmptyZ())
         {
             env.SetEmpty();
         }
         else
         {
             // Z components is empty, the
             // AffineTransformation3D makes the whole
             // envelope empty. Consider
             // throwing an assert instead.
             transform.Transform(env);
         }
     }
 }
Exemplo n.º 8
0
 /// <summary>Applies 3D affine transformation.</summary>
 /// <remarks>Applies 3D affine transformation. Adds Z attribute if it is missing.</remarks>
 /// <param name="transform">The affine transformation to be applied to this geometry.</param>
 internal abstract void ApplyTransformation(com.epl.geometry.Transformation3D transform);
Exemplo n.º 9
0
 internal override void ApplyTransformation(com.epl.geometry.Transformation3D transform)
 {
     m_impl.ApplyTransformation(transform);
 }
 public void MulLeft(com.epl.geometry.Transformation3D left)
 {
     Multiply(left, this, this);
 }
 public void Mul(com.epl.geometry.Transformation3D right)
 {
     Multiply(this, right, this);
 }