View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000854 | MetaPost | bug | public | 2013-09-20 16:39 | 2017-03-17 14:58 |
Reporter | Taco | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | confirmed | Resolution | open | ||
Summary | 0000854: Strange behavior of turningnumber | ||||
Description | From Pichaureau: Hi (again), I've to say that I'm very impressed by the progress on metapost. The new numbersystem feature is a big improvement ! Anyway, in mpost 1.802, I've find this strange behavior of turningnumber: z1 = (50,50); z2 = (100,50); z3= (100,100); z4 = (50,100); path p,q; p = (z1---z2..z3---z4--cycle); % p counterclockwise q = (reverse p); show (turningnumber p); show (turningnumber q); end. The turningnumber of p is 1, but the turningnumber of q is 0 | ||||
Tags | No tags attached. | ||||
|
We can use a modified version of straighten_path, from plain_ex.mp (mt1 package): if unknown mpversion: def beginfig(expr n) = enddef; def endfig = enddef; def draw text t = enddef; def fill text t = enddef; else: autorounding:=0; % good to remember fi vardef straighten_path(expr r) = save L,l,M; M:=4092/(length r); L:=M*length r; l:=(length r)/L; for k=0 upto L - 1: point (k*l) of r -- endfor if cycle r: cycle else: point infinity of r fi enddef; z1 = (50,50); z2 = (100,50); z3= (100,100); z4 = (50,100); path p,q; p = (z1---z2..z3---z4--cycle); % p counterclockwise q = (reverse p); show (turningnumber p); show (turningnumber q); show (turningnumber straighten_path(p)); show (turningnumber straighten_path(q)); end. |