Revision 5408 trunk/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfFeatureMaker.java

View differences:

DxfFeatureMaker.java
3520 3520
            cz = grp.getDataAsDouble(30);
3521 3521
        }
3522 3522
     
3523
        // end_point_major_axis        
3523
        // end_point_major_axis  (RELATIVE to the center)      
3524 3524
        x_end_point_major_axis = grp.getDataAsDouble(11);
3525 3525
        y_end_point_major_axis = grp.getDataAsDouble(21);
3526
        if (grp.hasCode(30)) {
3526
        if (grp.hasCode(31)) {
3527 3527
            z_end_point_major_axis = grp.getDataAsDouble(31);
3528 3528
        }
3529 3529

  
......
3532 3532
        	ratio_minor_to_major_axis = grp.getDataAsDouble(40);
3533 3533
        }
3534 3534
        Point2D c = proj.createPoint(cx, cy);
3535
        Point2D end_major = proj.createPoint(x_end_point_major_axis, y_end_point_major_axis);
3536
        double r_major_axis_2D = c.distance(end_major)/2.0; 
3535
        // Point2D end_major = proj.createPoint(x_end_point_major_axis, y_end_point_major_axis);
3536
        // double r_major_axis_2D = c.distance(end_major)/2.0;
3537
        double r_major_axis_2D = Math.sqrt(x_end_point_major_axis*
3538
        		x_end_point_major_axis + 
3539
        		y_end_point_major_axis * y_end_point_major_axis);
3537 3540
        double r_minor_axis_2D = r_major_axis_2D * ratio_minor_to_major_axis;
3538
        double rotation_angle = Math.atan2((y_end_point_major_axis - cy), (x_end_point_major_axis-cx));
3541
        double rotation_angle = Math.atan2(y_end_point_major_axis , x_end_point_major_axis);
3539 3542

  
3540 3543
        if (grp.hasCode(210)) {
3541 3544
            extx = grp.getDataAsDouble(210);
......
3570 3573
        int angulo = 0;
3571 3574

  
3572 3575
        for (angulo = 0; angulo < 360; angulo++) {
3573
            pts[angulo] = new Point3D(center.getX(), center.getY(),
3576
            pts[angulo] = new Point3D(center.getX() +
3577
                                      r_major_axis_2D * Math.cos(Math.toRadians(angulo)),
3578
                                      center.getY() +
3579
                                      r_minor_axis_2D * Math.sin(Math.toRadians(angulo)),
3574 3580
                                      center.getZ());
3575
            pts[angulo] = new Point3D(pts[angulo].getX() +
3576
                                      (r_major_axis_2D * Math.sin((angulo * Math.PI) / (double) 180.0)),
3577
                                      pts[angulo].getY() +
3578
                                      (r_minor_axis_2D * Math.cos((angulo * Math.PI) / (double) 180.0)),
3579
                                      center.getZ());
3580 3581

  
3581 3582
            if (pts.length == 1) {
3582 3583
                firstPt = pts[angulo];

Also available in: Unified diff