CXT105@psuvm.psu.edu (Christopher Tate) (05/29/91)
In article <1991May28.134420.3951@engage.pko.dec.com>, davis@3d.enet.dec.com (Peter Davis) says: > >This is very simple: > > (N) true charpath flattenpath pathbbox > /y2 exch def /x2 exch def /y1 exch def /x1 exch def > /height y2 y1 sub def > newpath I'm curious. Why execute flattenpath before pathbbox? What happens if you omit the call to flattenpath? Shouldn't the above code cause different results based on the value of currentflat? ------- Christopher Tate | | Quidquid latine dictum sit, cxt105@psuvm.psu.edu | altum viditur. cxt105@psuvm.bitnet |
bkph@rice-chex.ai.mit.edu (Berthold K.P. Horn) (05/29/91)
If you don't execute flattenpath before pathbox, you will get a bounding box for the knots and control points of the path, not of the pat itself. The bounding box may be larger than that of the character outline as a result of the fact that the control points do not lie on the path. Conversely, the bounding box of the knots and control points may be smaller then that of the character because a part of the outline may `bulge out' betwen control points. In a properly designed Type 1 font this is not a problem since there must be knots at all extrema of the outline and so all control points lie in or on the character outline bounding box. But in some Type 1 fonts this is not the case, and it certainly isn't the case in the typical Type 3 font (if there is such a thing)... Berthold.
rokicki@neon.Stanford.EDU (Tomas G. Rokicki) (05/29/91)
> Conversely, the bounding box of the knots and control points may be > smaller than that of the character . . . Not true; one characteristic of a bezier cubic is that the it is completely contained within the polygon formed by the four control points. -tom
adrianho@barkley.berkeley.edu (Adrian J Ho) (05/29/91)
In article <91148.135401CXT105@psuvm.psu.edu> CXT105@psuvm.psu.edu (Christopher Tate) writes: >In article <1991May28.134420.3951@engage.pko.dec.com>, davis@3d.enet.dec.com >(Peter Davis) says: >> >>This is very simple: >> >> (N) true charpath flattenpath pathbbox >> /y2 exch def /x2 exch def /y1 exch def /x1 exch def >> /height y2 y1 sub def >> newpath >I'm curious. Why execute flattenpath before pathbbox? What happens if >you omit the call to flattenpath? ``If the path includes curve segments, the bounding box enclosed the control points of the curves as well as the curves themselves. To obtain a bounding box that fits the path more tightly, one should first "flatten" the curve segments by executing 'flattenpath.' '' [Postscript Language Reference Manual, 2ed, pp. 461] > Shouldn't the above code cause >different results based on the value of currentflat? Perhaps a net.PS.guru could answer this question -- I can't. 8-)
kevin@kosman.UUCP (Kevin O'Gorman) (05/29/91)
bkph@rice-chex.ai.mit.edu (Berthold K.P. Horn) writes: }If you don't execute flattenpath before pathbox, you will get a bounding }box for the knots and control points of the path, not of the pat itself. } ... }In a properly designed Type 1 font this is not a problem since there must be ^^^^^^^^^^^^^ }knots at all extrema of the outline and so all control points lie in or on the }character outline bounding box. But in some Type 1 fonts this is not the }case, and it certainly isn't the case in the typical Type 3 font (if there }is such a thing)... Is this really true? I'm wondering about the case of rotated letterforms and slanted letterforms. I think it's easy in such a case for there to be real extensions of the path beyond the BB of the control points. Try a 45-degree rotated dot or something... Granted, this is not *common* but if you're looking for full generality in your algorithms, it's wise to think of such things. -- Kevin O'Gorman ( kevin@kosman.UUCP, kevin%kosman.uucp@nrc.com ) voice: 805-984-8042 Vital Computer Systems, 5115 Beachcomber, Oxnard, CA 93035 Non-Disclaimer: my boss is me, and he stands behind everything I say.
woody@chinacat.unicom.com (Woody Baker @ Eagle Signal) (05/29/91)
In article <91148.135401CXT105@psuvm.psu.edu> CXT105@psuvm.psu.edu (Christopher Tate) writes: >In article <1991May28.134420.3951@engage.pko.dec.com>, davis@3d.enet.dec.com >(Peter Davis) says: >> >> (N) true charpath flattenpath pathbbox > >I'm curious. Why execute flattenpath before pathbbox? What happens if Char paths contain cubic splines. The control points for these splines may be outside of the character bounding box. They are however, part of the path that is used to compute the bounding box by pathbbox. Flattenpath reduces them to straight lines such that the coordinates lie within the bounding box, thus allowing a true computation of the letter bounding box. Cheers Woody
bkph@wheat-chex.ai.mit.edu (Berthold K.P. Horn) (05/29/91)
} In a properly designed Type 1 font this is not a problem since there must be } knots at all extrema of the outline; so all control points lie in or on the } character outline bounding box. But in some Type 1 fonts this is not the } case, and it certainly isn't the case in the typical Type 3 font (if there } is such a thing)... > Is this really true? I'm wondering about the case of rotated letterforms > and slanted letterforms. I think it's easy in such a case for there to > be real extensions of the path beyond the BB of the control points. Well, yes, but you can't use the bounding box (rectangle aligned with x and y axes) of a rotated character to do what the original author wanted to do, namely mirror characters about the character's horizontal or vertical axis. You need a bounding box with sides parallel to the original x and y axes of the space in which the character is defined...
davis@3d.enet.dec.com (Peter Davis) (05/29/91)
In article <1356@kosman.UUCP>, kevin@kosman.UUCP (Kevin O'Gorman) writes... >bkph@rice-chex.ai.mit.edu (Berthold K.P. Horn) writes: > > >}If you don't execute flattenpath before pathbox, you will get a bounding >}box for the knots and control points of the path, not of the pat itself. >} ... > >}In a properly designed Type 1 font this is not a problem since there must be > ^^^^^^^^^^^^^ >}knots at all extrema of the outline and so all control points lie in or on the >}character outline bounding box. But in some Type 1 fonts this is not the >}case, and it certainly isn't the case in the typical Type 3 font (if there >}is such a thing)... > >Is this really true? I'm wondering about the case of rotated letterforms >and slanted letterforms. I think it's easy in such a case for there to >be real extensions of the path beyond the BB of the control points. >Try a 45-degree rotated dot or something... Granted, this is not *common* >but if you're looking for full generality in your algorithms, it's wise >to think of such things. You don't have to worry about the path extending outside the bounding box of the control points. The control polygon always completely contains the curve, so the bbox of the polygon also contains the curve. However, you may have extra room in the bbox for the control points, which you don't want. In order to invert a character, you need to know not the bounding box of the path defining the character's outline, but rather the bounding box of the area on the surface which will be marked when the character is drawn. Yes, this will be affected by the value of the flatness parameter in the graphics state, but that probably won't have a perceptible affect on the results in this case. In fact, I think all Adobe PS interpreters effectively flatten a path before rendering it anyway, so really doing flattenpath is giving you a more accurate measure of the size of the character mark. -pd
cunniff@hpfcso.FC.HP.COM (Ross Cunniff) (05/29/91)
In article <16154@life.ai.mit.edu> bkph@rice-chex.ai.mit.edu (Berthold K.P. Horn) writes: > If you don't execute flattenpath before pathbox, you will get a bounding > box for the knots and control points of the path, not of the pat itself. > The bounding box may be larger than that of the character outline as a > result of the fact that the control points do not lie on the path. True. > Conversely, the bounding box of the knots and control points may be smaller > then that of the character because a part of the outline may `bulge out' > betwen control points. Not true. The control points of a Bezier spline are on or outside the convex hull of the curve; i.e. the curve cannot extend 'outside' the polygon defined by the control points. Just a minor nit :-) > Berthold. Ross Cunniff Hewlett-Packard Colorado Language Lab cunniff@hpfcla.HP.COM