[metapost] Trying to figure out MPLib
samjnaa at gmail.com
Mon Aug 6 16:39:16 CEST 2012
On Sun, Aug 5, 2012 at 6:53 PM, luigi scarso <luigi.scarso at gmail.com> wrote:
> control_points == nodes implies that one cannot calculate the derivatives
> with the simple formula of derivative, but must introduce another check.
Are you referring to the usage of "direction of" etc?
But anyhow in the case of the nodes created by make-path and
make-envelope that will be a problem no? Or are those paths not
subjectable to direction operators?
IMHO it would be cleaner to introduce that check there instead of
here. The direction of operators are not used so often that
introducing the check there would be a severe performance penalty or
anything. (Even then, how much processing time are a few
addition/subtraction operations and if statements going to take) OTOH
the output functions are used very often. While I'm not saying that
there is a big performance issue *there*, I am saying that in the
interests of ease of usage of the library (and not just in the psout
and svgout backends) it would be better to do this i.e. assign control
points to nodes for straight lines.
The make-choices function has the direct first hand knowledge of which
segments are straight because it is processing the "--" input. So it
can assign the controls to the nodes without testing for anything
else. OTOH testing for a minimal curvature in the output functions
might not be such a good idea especially if we are going to go for
higher precision in the future -- what is the maximum curvature which
would be considered as straight and would it be good for the code (aka
coders) to arbitrarily determine that? Equating the controls to the
nodes would eliminate the problem because binary equal is always
IMHO clearly tagging straight segments as straight which are straight
*by user specification* is better than doing it to those which are
straight by *assumption* of the program.
> Also very slight curvature are always a problem, w.r.t the choice of
> control_points == nodes or not are not so important.
Um, am not sure what exactly you mean. Can you restate that?
More information about the metapost