Examples of Vec2


Examples of de.micromata.opengis.kml.v_2_2_0.Vec2

           
            return feature;
        }

        private Vec2 createPixelsVec(int x, int y) {
            Vec2 vec = new Vec2();
            vec.setX(x);
            vec.setY(y);
            vec.setXunits(Units.PIXELS);
            vec.setYunits(Units.PIXELS);
            return vec;
        }
View Full Code Here

Examples of fcagnin.jglsdk.glm.Vec2

      m_bIsDragging = true;
    }

   
    private void onDragRotate(Vec2 ptCurr) {
      Vec2 iDiff = Vec2.sub(ptCurr, m_startDragMouseLoc);
      int iXDiff = (int) iDiff.x;
      int iYDiff = (int) - iDiff.y;                      // Y axis is different in LWJGL
     
      switch (m_RotateMode) {
        case RM_DUAL_AXIS_ROTATE:
View Full Code Here

Examples of jjil.algorithm.j2se.Vec2

     * @throws jjil.core.Error if some of the edges in t1 are of length zero
     */
    public TriangleMap(Triangle t1, Triangle t2) throws jjil.core.Error {
        this.p1 = t1.getP1();
        this.p2 = t2.getP1();
        Vec2 s12, s13, s22, s23;
        s12 = new Vec2(this.p1, t1.getP2());
        s13 = new Vec2(this.p1, t1.getP3());
        s22 = new Vec2(this.p2, t2.getP2());
        s23 = new Vec2(this.p2, t2.getP3());

        // The matrix transformation is
        // A vT = u
        // where vT is the original vector (s12 or s13), transposed,
        // and u is the transformed vector (s22 or s23).
        // The solution to the transformation is
        // A = [s22T s23T][s12T s13T]-1 = [s22T s23T] B-1
        // Where -1 indicates matrix inversion of the 2x2 matrix (denoted B) formed from
        // the transposed vectors s12T and s13T.
        // Matrix inversion of a 2x2 matrix is easy.
        double detB = s12.getX() * s13.getY() - s13.getX() * s12.getY();
        if (detB == 0.0d) {
            throw new Error(
                            Error.PACKAGE.ALGORITHM,
                            ErrorCodes.PARAMETER_OUT_OF_RANGE,
                            t1.toString(),
                            null,
                            null);
        }
        double Binv[][] = new double[2][2];
        Binv[0][0] = s13.getY() / detB;
        Binv[0][1] = -s13.getX() / detB;
        Binv[1][0] = -s12.getY() / detB;
        Binv[1][1] = s12.getX() / detB;
        // finally form A
        this.A = new double[2][2];
        this.A[0][0] = s22.getX() * Binv[0][0] + s23.getX() * Binv[1][0];
        this.A[0][1] = s22.getX() * Binv[0][1] + s23.getX() * Binv[1][1];
        this.A[1][0] = s22.getY() * Binv[0][0] + s23.getY() * Binv[1][0];
 
View Full Code Here

Examples of jjil.algorithm.j2se.Vec2

     * Map point in one triangle into the other triangle
     * @param p Point to map
     * @return mapped Point
     */
    public Point map(Point p) {
        Vec2 v = new Vec2(p1, p);
        // multiply by A
        Vec2 v2 = new Vec2(
                this.A[0][0]*v.getX() + this.A[0][1]*v.getY(),
                this.A[1][0]*v.getX() + this.A[1][1]*v.getY());
        return v2.add(p2);
    }
View Full Code Here

Examples of jjil.core.Vec2

                    (p.getY()*this.mnScale+this.mnOffsetY)/256);
            Point ptNext = cli.getNext().getPos();
            Point posNext = new Point((ptNext.getX()*this.mnScale+this.mnOffsetX)/256,
                    (ptNext.getY()*this.mnScale+this.mnOffsetY)/256);
            Point pt = new Point((int) pos.getX(), (int) pos.getY());
            Vec2 vec = new Vec2((int) (posNext.getX() - pos.getX()),
                    (int) (posNext.getY() - pos.getY()));
            polypts.add(new EdgePt(pt,vec));
        }
        this.add(polypts);
       
View Full Code Here

Examples of jjil.core.Vec2

     * Sets the vector from this EdgePt to the next.
     *
     * @param nextPt the new vector to the next EdgePt
     */
    void setVec(EdgePt nextPt) {
        this.mvNext = new Vec2(this.getPos(), nextPt.getPos());
    }
View Full Code Here

Examples of jjil.core.Vec2

     */
    public Features(List<EdgePts> leps) {
      this.mnComponents = leps.size();
        this.mleps = leps;
        /* find this.mvMean.getX(), this.mvMean.getY() */
        Vec2 Sum = new Vec2(0, 0);
        int LengthSum = 0;
        for (CircularList<EdgePt> OutLine : leps) {
            if (OutLine.size() <= 1) {
                continue;
            }
            CircularList<EdgePt>.CircListIter li = OutLine.circListIterator();
            Point Last = li.getNext().getPos();
            while (li.hasNext()) {
                li.next();
                Point Norm = li.getNext().getPos();
                int n = 1;
                Vec2 Delta = new Vec2(Last, Norm);
                int Length = 0;
                try {
                    Length = Delta.length();
                } catch (jjil.core.Error ex) {
                }
                n = ((Length << 2) + Length + 32) >> 6;
                if (n != 0) {
                    Sum.add(((Last.getX()<<1)+Delta.getX())*Length,
                        ((Last.getY()<<1)+Delta.getY())*Length);
                    LengthSum += Length;
                }
                if (n != 0) {
                    Last = Norm;
                }
View Full Code Here

Examples of jjil.core.Vec2

                Point Norm = new Point(LastX, LastY);
                if (Last == null) {
                    Last = Norm;
                } else {
                    int n = 1;
                    Vec2 Delta = new Vec2(Last, Norm);
                    int Length = 0;
                    try {
                        Length = Delta.length();
                    } catch (jjil.core.Error ex) {
                    }
                    n = ((Length << 2) + Length + 32) >> 6;
                    if (n != 0) {
                        short Theta = mPrecomputeMath.TableLookup(Delta);
                        Vec2 d = Delta.lsh(8).div(n);
                        Vec2 pf = new Vec2(Last).lsh(8).add(d.clone().rsh(1));
                        for (int i = 0; i < n; i++) {
                          // check to see if we're out of static feature
                          // slots
                          if (snFeaturesUsed == MAX_FEATURES) {
                            return;
                          }
                          Feature f = srFeatures[snFeaturesUsed++];
                          f.set((short) (pf.getX() >> 8),
                                    (short) ((pf.getY() >> 8)),
                                    Theta);
                            if (!this.add(f)) {
                                return;
                            }
                            pf.add(d);
                        }
                    }
                    if (n != 0) {              /* Throw away a point that is too close */
                        Last = Norm;
                    }
View Full Code Here

Examples of jjil.core.Vec2

     * Compute the radius of gyration.
     *
     * @param leps the leps
     */
    private void computeRadiusGyration(List<EdgePts> leps) {
        Vec2 vMeanShift = this.mvMean.clone().lsh(8);
        int nBLFeat = 0;
        Vec2 I = new Vec2(0, 0);
        for (CircularList<EdgePt> Outline : leps) {
            if (Outline.size() <= 1) {
                continue;
            }
            Point Last = null;
            for (ListIterator<EdgePt> li = Outline.loopIterator();
                    li.hasNext();) {
                EdgePt Segment = li.next();
                Point Norm = Segment.getPos().clone();
                if (Last == null) {
                    Last = Norm;
                } else {
                    int n = 1;
                    Vec2 Delta = new Vec2(Last, Norm);
                    int Length = 0;
                    try {
                        Length = Delta.length();
                    } catch (jjil.core.Error ex) {
                    }
                    n = ((Length << 2) + Length + 32) >> 6;
                    nBLFeat += n;
                    if (n != 0) {
                        Vec2 d = Delta.lsh(8).div(n);
                        Vec2 pf = new Vec2(Last).lsh(8).add(d.clone().rsh(1)).
                                sub(vMeanShift);
                        long lX = (long) pf.getX() * pf.getX() * n +
                                (long) pf.getX() * d.getX() * n * (n - 1) +
                                (long) d.getX() * d.getX() * n * (n - 1) * (2 * n - 1) / 6;
                        long lY = (long) pf.getY() * pf.getY() * n +
                                (long) pf.getY() * d.getY() * n * (n - 1) +
                                (long) d.getY() * d.getY() * n * (n - 1) * (2 * n - 1) / 6;
                        I.add((int) (lX >> 16), (int) (lY >> 16));
                        Last = Norm;
                    }
                }
View Full Code Here

Examples of jjil.core.Vec2

        this.rprResult = new int[32/RESULT_TABLE_REDUCTION][64][64];
for (int i=0; i<32; i+=RESULT_TABLE_REDUCTION) {
            for (int j=0; j<64; j++) {
//              this.rprResult[i][j] = IntBuffer.allocate(64);
                for (int k=0; k<64; k++) {
                    Vec2 sqrtX = MySqrt2(i<<2, j<<13);
                    Vec2 sqrtY = MySqrt2(i<<2, k<<13);
                    this.rprResult[i/RESULT_TABLE_REDUCTION][j][k] =
                            PairVec2Int(ClipRadius(sqrtX, sqrtY));
//                    this.rprResult[i][j][k] =
//                            ClipRadius(sqrtX, sqrtY);
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.