Announcement

Collapse
No announcement yet.

Elipse

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Elipse

    Graphic/Xprint question

    I have a report that in the actual report uses I guess what would be called an ellipse -- actually 4 of them as a 'box' that is checked depending on the fiscal Quarter. Currently I am using a box command and rounding the edges with the edge parameter. This works quite nicely but is still an up/down modified box. I would like to make it look the same except leaning to the left at about 45 degrees.

    I am sure that it can be done with polygon and I have, in fact, used polygon for other things. I just wondered if anyone has done this sort of thing ?

    I'm basically using (at roughly 10CPI 6LPI) using a box 1 character wide, 1 row high with a corner value of 80.
    I could use an Ellipse statement but it does no better as it's always oriented up/down.

    Thanks in advance for any suggestions.
    Last edited by Fred Buffington; 7 Feb 2009, 07:36 PM.
    Client Writeup for the CPA

    buffs.proboards2.com

    Links Page

  • #2
    Ellipse by Beziers

    The following code is from C++.
    But it is simple enough to use it for PB translation.

    // Create points to simulate ellipse using beziers
    void EllipseToBezier(CRect& r, CPoint* cCtlPt)
    {
    // MAGICAL CONSTANT to map ellipse to beziers
    // 2/3*(sqrt(2)-1)
    const double EToBConst = 0.2761423749154;
    Code:
        CSize offset((int)(r.Width() * EToBConst), (int)(r.Height() * EToBConst));
    //  Use the following line instead for mapping systems where +ve Y is upwards
    //  CSize offset((int)(r.Width() * EToBConst), -(int)(r.Height() * EToBConst));
    
        CPoint centre((r.left + r.right) / 2, (r.top + r.bottom) / 2);
    
        cCtlPt[0].x  =                 	                //---------------------/
        cCtlPt[1].x  =                            	//                        	/
        cCtlPt[11].x =                            	//        2___3___4       	/
        cCtlPt[12].x = r.left;                    	//     1             	   5   	/
        cCtlPt[5].x  =                            	//     |             	    |  	/
        cCtlPt[6].x  =                            	//     |                   |  	/
        cCtlPt[7].x  = r.right;                   	//     0 and 12        6   /
        cCtlPt[2].x  =                            	//     |                   |  	/
        cCtlPt[10].x = centre.x - offset.cx;     //     |                   |  	/
        cCtlPt[4].x  =                            	//    11                  7  	/
        cCtlPt[8].x  = centre.x + offset.cx;     //       10___9___8      /
        cCtlPt[3].x  =                            	//                        	/
        cCtlPt[9].x  = centre.x;                 	//---------------------*
    
        cCtlPt[2].y  =
        cCtlPt[3].y  =
        cCtlPt[4].y  = r.top;
        cCtlPt[8].y  =
        cCtlPt[9].y  =
        cCtlPt[10].y = r.bottom;
        cCtlPt[7].y  =
        cCtlPt[11].y = centre.y + offset.cy;
        cCtlPt[1].y  =
        cCtlPt[5].y  = centre.y - offset.cy;
        cCtlPt[0].y  =
        cCtlPt[12].y =
        cCtlPt[6].y  = centre.y;
    }
    Norbert Doerre

    Comment


    • #3
      Norbert,
      Hopeing my interpretation of the C Code is correct i did the following:
      Code:
      r_top!=0:r_bottom!=120
      r_left!=0:r_right!=72
      r_width!=r_right!-r_left!
      r_height!=r_bottom!-r_top!
      centrex!=(r_left!+r_right!)/2
      centrey!=(r_top!+r_bottom!)/2
      EtoBConst#=0.2761423749154
      offsetx!=r_width!*EtoBConst#
      offsety!=r_height!*EtoBCont#
      
       PRINT #1,"[POLY]013,";STR$(22*72+r_left!);",";STR$(22*120+centrey!);","+_
                             STR$(22*72+r_left!);",";STR$(22*120+centrey! - offsety!);","+_
                             STR$(22*72+centrex!-offsetx!);",";STR$(22*120+r_top!);","+_
                             STR$(22*72+centrex!);",";STR$(22*120+r_top!);","+_
                             STR$(22*72+centrex! + offsetx!);",";STR$(22*120+r_top!);","+_
                             STR$(22*72+r_right!);",";STR$(22*120+centrey! - offsety!);","+_
                             STR$(22*72+r_right!);",";STR$(22*120+centrey!);","+_
                             STR$(22*72+r_right!);",";STR$(22*120+centrey!+offsety!);","+_
                             STR$(22*72+centrex!+offsetx!);",";STR$(22*120+r_bottom!);","+_
                             STR$(22*72+centrex!);",";STR$(22*120+r_bottom!);","+_
                             STR$(22*72+centrex!-offsetx!);",";STR$(22*120+r_bottom!);","+_
                             STR$(22*72+r_left!);",";STR$(22*120+centrey!+offsety!);","+_
                             STR$(22*72+r_left!);",";STR$(22*120+centrey!);","+_
                             "0,-2"
      This is written to a file which is interpreted by my print/preview as
      a Polygram of 13 points. the 13 pairs after that are the x and y polypoints.
      then the final "0,-2" are the rgbcolor and the fillstyle (not filled).

      This makes a fairly good ellipse but it is not tilted to the left which is what I need. Guess i'll stick with the box with rounded corners or use the ellipse statemment.

      Oh, to make things clearer, I use a scale of 8.5*720, 11*720 for the full 8.5 x 11 page then subtract the left/right margins
      and top/bottom margins to get the printable area. So the 22*72 would be Column 72 and 22*120 would be Row 22 approxamately.
      at 10CPI/6LPI
      Last edited by Fred Buffington; 7 Feb 2009, 10:11 PM.
      Client Writeup for the CPA

      buffs.proboards2.com

      Links Page

      Comment


      • #4
        I think i'll use two arc's and join them with LINEs.
        Client Writeup for the CPA

        buffs.proboards2.com

        Links Page

        Comment


        • #5
          I came up with a better solution. First, after looking at the form again, the ellipses lean to the right instead.

          I decided to use a rotated font and use the '0' character instead which seems to work fine.
          Client Writeup for the CPA

          buffs.proboards2.com

          Links Page

          Comment

          Working...
          X