Skip Menu |

This queue is for tickets about the Math-Polygon CPAN distribution.

Report information
The Basics
Id: 34746
Status: rejected
Priority: 0/
Queue: Math-Polygon

People
Owner: Nobody in particular
Requestors: djerius [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Vertex attributes
It would be nice to be able to attach attributes to a vertex for later retrieval. For example, I have a set of independent vectors each of which is parameterized as a triple {base coordinate, angle, length}. I'd like to order the vectors by their base coordinates (using the Math::Polygon::clockwise() method), but need to retain the relationship between the coordinates and their associated angles and lengths.
Subject: Re: [rt.cpan.org #34746] Vertex attributes
Date: Tue, 8 Apr 2008 10:06:44 +0200
To: Diab Jerius via RT <bug-Math-Polygon [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Diab Jerius via RT (bug-Math-Polygon@rt.cpan.org) [080407 20:49]: Show quoted text
> Mon Apr 07 16:49:20 2008: Request 34746 was acted upon. > Transaction: Ticket created by DJERIUS > Queue: Math-Polygon > Subject: Vertex attributes > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=34746 > > > It would be nice to be able to attach attributes to a vertex for later > retrieval. For example, I have a set of independent vectors each of > which is parameterized as a triple {base coordinate, angle, length}. > I'd like to order the vectors by their base coordinates (using the > Math::Polygon::clockwise() method), but need to retain the relationship > between the coordinates and their associated angles and lengths.
The points in Math::Polygon are arrays of two elements, for performance reasons. What you suggest is to change them into either arrays of more elements, or arrays of HASHes. For a generally application implementation, you need a HASH per point. This would mean that all functions need to be rewritten... not something I would like to do. Besides, if you add attibutes, then some functions will need to change those as well. F.i. when a counter-clockwise poly is changed into a clockwise poly, then the angle attribute has to be changed. I think it is impossible to define a complete set of attributes, such that everyone has sufficient data... and still be fast. So... I think there is not justification to extend points into being more than an ARRAY of two coordinates. However, feel invited to extend Math::Polygon with an Math::Polygon::Vertex which extends the ARRAY with a few more (for your application useful) attributes. With some luck, you may not need to reimplement each of the existing methods. It would be nice to share the interface. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
A direction I do not want to go yet. Discussion closed for now