Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
Close
From: Amitha Perera <amithaperera@us...>  20070717 01:34:34

On Mon 16 Jul 2007, Wheeler, Frederick W (GE, Research) wrote: > Jason Zhang here at GE made these straightforward additions to > vgl_point_2d.h. Is it OK to check this in? This looks like a > nobrainer, but the fact that such simple and useful functions were not > already in vgl make we wonder whether there is a reason to not have > them. I think the reason is the distinction between points and vectors. You will find vgl_vector_2d that bridges the gap. A point is a general geometrical concept; the difference between points makes sense only(?) in a metric space. In recognition of the most widely used embedding, though, there are functions like midpoint(p1,p2,f). Amitha. 
From: Wheeler, Frederick W (GE, Research) <wheeler@cr...>  20070716 19:33:21
Attachments:
Message as HTML

VXL Maintainers: Jason Zhang here at GE made these straightforward additions to vgl_point_2d.h. Is it OK to check this in? This looks like a nobrainer, but the fact that such simple and useful functions were not already in vgl make we wonder whether there is a reason to not have them. Fred % cvs di vgl_point_2d.h Index: vgl_point_2d.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/vxl/vxl/core/vgl/vgl_point_2d.h,v retrieving revision 1.37 diff u r1.37 vgl_point_2d.h  vgl_point_2d.h 5 Dec 2003 14:19:32 0000 1.37 +++ vgl_point_2d.h 16 Jul 2007 19:30:11 0000 @@ 13,6 +13,8 @@ // Modifications // 29 June 2001 Peter Vanroose moved arithmetic operators to new vgl_vector_2d // 2 July 2001 Peter Vanroose implemented constructor from homg point +// 11 June 2007 Jason Zhang  added inline selfmanipulation operators +// '+=3D', '*=3D' and '/=3D', and binary manipulation operators = '+', '*' and '/' // \endverbatim =20 #include <vcl_iosfwd.h> @@ 65,6 +67,16 @@ inline bool operator!=3D(vgl_point_2d<Type>const& p)const { return !operator=3D=3D(p); } =20 + //: Self addition + inline vgl_point_2d<Type>& operator+=3D(const vgl_point_2d<Type>& p) + { x_ +=3D p.x(); y_ +=3D p.y(); return *this; } + //: Self multiplication by a scalar value + inline vgl_point_2d<Type>& operator*=3D(const Type& d) + { x_ *=3D d; y_ *=3D d; return *this; } + //: Self division by a scalar value other than 0 (not checked) + inline vgl_point_2d<Type>& operator/=3D(const Type& d) + { x_ /=3D d; y_ /=3D d; return *this; } + // Data Access =20 inline Type &x() {return x_;} @@ 119,6 +131,22 @@ vgl_vector_2d<Type> const& v) { return vgl_point_2d<Type>(p.x()+v.x(), p.y()+v.y()); } =20 +//: Addition of two points +template <class Type> inline +vgl_point_2d<Type> operator+(vgl_point_2d<Type> const& p1, + vgl_point_2d<Type> const& p2) +{ return vgl_point_2d<Type>(p1.x()+p2.x(), p1.y()+p2.y()); } + +//: Multiplication by a scalar value +template <class Type> inline +vgl_point_2d<Type> operator*(vgl_point_2d<Type> const& p, const Type& d) +{ return vgl_point_2d<Type>(p.x()*d, p.y()*d); } + +//: Division by a scalar value other than 0 (not checked) +template <class Type> inline +vgl_point_2d<Type> operator/(vgl_point_2d<Type> const& p, const Type& d) +{ return vgl_point_2d<Type>(p.x()/d, p.y()/d); } + //: Adding a vector to a point gives the point at the end of that vector // \relates vgl_point_2d template <class Type> inline 
From: Amitha Perera <amithaperera@us...>  20070717 01:34:34

On Mon 16 Jul 2007, Wheeler, Frederick W (GE, Research) wrote: > Jason Zhang here at GE made these straightforward additions to > vgl_point_2d.h. Is it OK to check this in? This looks like a > nobrainer, but the fact that such simple and useful functions were not > already in vgl make we wonder whether there is a reason to not have > them. I think the reason is the distinction between points and vectors. You will find vgl_vector_2d that bridges the gap. A point is a general geometrical concept; the difference between points makes sense only(?) in a metric space. In recognition of the most widely used embedding, though, there are functions like midpoint(p1,p2,f). Amitha. 
From: Ian Scott <ian.scott@st...>  20070717 08:34:27

I'd have to agree with Amitha here, and vote to reject the mods. The distinction between points and vectors was an explicit design decision in vgl. At times it is annoying, especially if you are not used to it. However, there have been occasions when the strict typing has picked up mistakes in our code. Ian. Amitha Perera wrote: > On Mon 16 Jul 2007, Wheeler, Frederick W (GE, Research) wrote: >> Jason Zhang here at GE made these straightforward additions to >> vgl_point_2d.h. Is it OK to check this in? This looks like a >> nobrainer, but the fact that such simple and useful functions were not >> already in vgl make we wonder whether there is a reason to not have >> them. > > I think the reason is the distinction between points and vectors. You > will find vgl_vector_2d that bridges the gap. A point is a general > geometrical concept; the difference between points makes sense only(?) > in a metric space. > > In recognition of the most widely used embedding, though, there are > functions like midpoint(p1,p2,f). > > Amitha. > >  > This SF.net email is sponsored by DB2 Express > Download DB2 Express C  the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Vxlmaintainers mailing list > Vxlmaintainers@... > https://lists.sourceforge.net/lists/listinfo/vxlmaintainers 
From: Zhang, Jason (GE, Research, consultant) <zhangj@ge...>  20070717 12:31:52

It is just because that a point is a geometric entity, we find in many cases that points are used alternatively with vectors to make representation and processing tasks such as displacing and scaling more convenient to implement. In their current implementation however, either vgl_point nor vgl_vector has defined these operators yet. Jason Zhang Original Message From: vxlmaintainersbounces@... [mailto:vxlmaintainersbounces@...] On Behalf Of Ian Scott Sent: Tuesday, July 17, 2007 4:34 AM To: Wheeler, Frederick W (GE, Research); vxlmaintainers@... Cc: Amitha Perera Subject: Re: [Vxlmaintainers] Proposed addition to vgl_point_2d.h I'd have to agree with Amitha here, and vote to reject the mods. The distinction between points and vectors was an explicit design decision in vgl. At times it is annoying, especially if you are not used to it. However, there have been occasions when the strict typing has picked up mistakes in our code. Ian. Amitha Perera wrote: > On Mon 16 Jul 2007, Wheeler, Frederick W (GE, Research) wrote: >> Jason Zhang here at GE made these straightforward additions to=20 >> vgl_point_2d.h. Is it OK to check this in? This looks like a=20 >> nobrainer, but the fact that such simple and useful functions were=20 >> not already in vgl make we wonder whether there is a reason to not=20 >> have them. >=20 > I think the reason is the distinction between points and vectors. You > will find vgl_vector_2d that bridges the gap. A point is a general=20 > geometrical concept; the difference between points makes sense only(?) > in a metric space. >=20 > In recognition of the most widely used embedding, though, there are=20 > functions like midpoint(p1,p2,f). >=20 > Amitha. >=20 >  >  This SF.net email is sponsored by DB2 Express Download DB2 Express > C  the FREE version of DB2 express and take control of your XML. No=20 > limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Vxlmaintainers mailing list > Vxlmaintainers@... > https://lists.sourceforge.net/lists/listinfo/vxlmaintainers   This SF.net email is sponsored by DB2 Express Download DB2 Express C  the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Vxlmaintainers mailing list Vxlmaintainers@... https://lists.sourceforge.net/lists/listinfo/vxlmaintainers 
From: Ian Scott <ian.scott@st...>  20070717 12:52:40

Jason I may have misunderstood you, but vgl_vector_2d (and 3d) do already have operators += and *=, etc. You may not have spotted them since they are not implemented as member operators but as standalone operators. Take a look at lines 100135 in vgl_vector_2d.h Ian. Zhang, Jason (GE, Research, consultant) wrote: > It is just because that a point is a geometric entity, we find in many > cases that points are used alternatively with vectors to make > representation and processing tasks such as displacing and scaling more > convenient to implement. In their current implementation however, either > vgl_point nor vgl_vector has defined these operators yet. > > Jason Zhang > > Original Message > From: vxlmaintainersbounces@... > [mailto:vxlmaintainersbounces@...] On Behalf Of Ian > Scott > Sent: Tuesday, July 17, 2007 4:34 AM > To: Wheeler, Frederick W (GE, Research); > vxlmaintainers@... > Cc: Amitha Perera > Subject: Re: [Vxlmaintainers] Proposed addition to vgl_point_2d.h > > I'd have to agree with Amitha here, and vote to reject the mods. > > The distinction between points and vectors was an explicit design > decision in vgl. At times it is annoying, especially if you are not used > to it. However, there have been occasions when the strict typing has > picked up mistakes in our code. > > Ian. > > Amitha Perera wrote: >> On Mon 16 Jul 2007, Wheeler, Frederick W (GE, Research) wrote: >>> Jason Zhang here at GE made these straightforward additions to >>> vgl_point_2d.h. Is it OK to check this in? This looks like a >>> nobrainer, but the fact that such simple and useful functions were >>> not already in vgl make we wonder whether there is a reason to not >>> have them. >> I think the reason is the distinction between points and vectors. You > >> will find vgl_vector_2d that bridges the gap. A point is a general >> geometrical concept; the difference between points makes sense only(?) > >> in a metric space. >> >> In recognition of the most widely used embedding, though, there are >> functions like midpoint(p1,p2,f). >> >> Amitha. >> >>  >>  This SF.net email is sponsored by DB2 Express Download DB2 Express > >> C  the FREE version of DB2 express and take control of your XML. No >> limits. Just data. Click to get it now. >> http://sourceforge.net/powerbar/db2/ >> _______________________________________________ >> Vxlmaintainers mailing list >> Vxlmaintainers@... >> https://lists.sourceforge.net/lists/listinfo/vxlmaintainers > > >  >  > This SF.net email is sponsored by DB2 Express Download DB2 Express C  > the FREE version of DB2 express and take control of your XML. No limits. > Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Vxlmaintainers mailing list > Vxlmaintainers@... > https://lists.sourceforge.net/lists/listinfo/vxlmaintainers > >  > This SF.net email is sponsored by DB2 Express > Download DB2 Express C  the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Vxlmaintainers mailing list > Vxlmaintainers@... > https://lists.sourceforge.net/lists/listinfo/vxlmaintainers 
From: Zhang, Jason (GE, Research, consultant) <zhangj@ge...>  20070717 13:08:27

Ian, Thanks for your clarification. I didn't find the implementation for vgl_vector_2d. Sorry about that. Jason Original Message From: Ian Scott [mailto:ian.m.scott@...]=20 Sent: Tuesday, July 17, 2007 8:52 AM To: Zhang, Jason (GE, Research, consultant) Cc: vxlmaintainers@... Subject: Re: [Vxlmaintainers] Proposed addition to vgl_point_2d.h Jason I may have misunderstood you, but vgl_vector_2d (and 3d) do already have operators +=3D and *=3D, etc. You may not have spotted them since they = are not implemented as member operators but as standalone operators. Take a look at lines 100135 in vgl_vector_2d.h Ian. Zhang, Jason (GE, Research, consultant) wrote: > It is just because that a point is a geometric entity, we find in many > cases that points are used alternatively with vectors to make=20 > representation and processing tasks such as displacing and scaling=20 > more convenient to implement. In their current implementation however, > neither vgl_point nor vgl_vector has defined these operators yet. >=20 > Jason Zhang >=20 > Original Message > From: vxlmaintainersbounces@... > [mailto:vxlmaintainersbounces@...] On Behalf Of=20 > Ian Scott > Sent: Tuesday, July 17, 2007 4:34 AM > To: Wheeler, Frederick W (GE, Research);=20 > vxlmaintainers@... > Cc: Amitha Perera > Subject: Re: [Vxlmaintainers] Proposed addition to vgl_point_2d.h >=20 > I'd have to agree with Amitha here, and vote to reject the mods. >=20 > The distinction between points and vectors was an explicit design=20 > decision in vgl. At times it is annoying, especially if you are not=20 > used to it. However, there have been occasions when the strict typing=20 > has picked up mistakes in our code. >=20 > Ian. >=20 > Amitha Perera wrote: >> On Mon 16 Jul 2007, Wheeler, Frederick W (GE, Research) wrote: >>> Jason Zhang here at GE made these straightforward additions to=20 >>> vgl_point_2d.h. Is it OK to check this in? This looks like a=20 >>> nobrainer, but the fact that such simple and useful functions were=20 >>> not already in vgl make we wonder whether there is a reason to not=20 >>> have them. >> I think the reason is the distinction between points and vectors. =20 >> You >=20 >> will find vgl_vector_2d that bridges the gap. A point is a general=20 >> geometrical concept; the difference between points makes sense=20 >> only(?) >=20 >> in a metric space. >> >> In recognition of the most widely used embedding, though, there are=20 >> functions like midpoint(p1,p2,f). >> >> Amitha. >> >>  >>  >>  This SF.net email is sponsored by DB2 Express Download DB2=20 >> Express >=20 >> C  the FREE version of DB2 express and take control of your XML. No=20 >> limits. Just data. Click to get it now. >> http://sourceforge.net/powerbar/db2/ >> _______________________________________________ >> Vxlmaintainers mailing list >> Vxlmaintainers@... >> https://lists.sourceforge.net/lists/listinfo/vxlmaintainers >=20 >=20 >  >  >  > This SF.net email is sponsored by DB2 Express Download DB2 Express C  > the FREE version of DB2 express and take control of your XML. No limits. > Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Vxlmaintainers mailing list > Vxlmaintainers@... > https://lists.sourceforge.net/lists/listinfo/vxlmaintainers >=20 >  >  This SF.net email is sponsored by DB2 Express Download DB2 Express > C  the FREE version of DB2 express and take control of your XML. No=20 > limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Vxlmaintainers mailing list > Vxlmaintainers@... > https://lists.sourceforge.net/lists/listinfo/vxlmaintainers 