MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000854MetaPostbugpublic2013-09-20 16:392017-03-17 14:58
ReporterTaco 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000854: Strange behavior of turningnumber
DescriptionFrom 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
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0001671)
luigi scarso (manager)
2017-03-17 14:58

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.

- Issue History
Date Modified Username Field Change
2013-09-20 16:39 Taco New Issue
2013-09-20 16:39 Taco Status new => assigned
2013-09-20 16:39 Taco Assigned To => Taco
2014-03-10 12:34 Taco Assigned To Taco =>
2014-03-10 12:34 Taco Status assigned => confirmed
2017-03-17 14:58 luigi scarso Note Added: 0001671


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker