D
David Kozina
I found out yesterday that trying to make a variant with set of 3D points
(unwittingly) that should have been 2D and then use that variant to create a
LightweightPolyline object didn't have the outcome I quite expected.
"What the...?!" :-@
I tracked down the trouble in a 'Point/Vector addition' subroutine, which
automatically converted and then later output my 2D point list to a 3D point
list - which wasn't what I wanted to do in this case. I fixed it for this
particular problem, but I think it could be better.
So I was wondering what you people do to keep the dimensions correct - and
*especially* if you may be working with 'mixed dimension types', such as
adding a 2D xy vector to a set of 3D xyz points. If you use mapcar '+ for
this, you end up with a 2D pointlist when perhaps you really need those z
values.
When doing this type of point manipulation, have you found it best to
define/use a series of routines, like '1dVectorAdd', '2dVectorAdd',
'3dVectorAdd', etc. - OR - would it be better to create and use one routine
'VectorAdd', along with a desired output 'dimension' argument, perhaps like
(VectorAdd _vec _pts 2) - so that no matter *what* the input vector or point
list dimension happens to be, the output will be as indicated?
I'm leaning toward the second, since it seems to be a more 'all-encompasing'
solution (and fewer routines to keep track of), but I don't know if that
neccessarily results in better - faster/more readable/etc. - or worse code.
If this seems like a silly question or just a rehash of old topics, forgive
me, I've been gone awhile and feel a bit out of practice.
Mind you, I'm not necessarily looking for actual code, just some
opinions/reasons on what you consider to be good coding practice for this
sort of thing.
Many thanks,
David Kozina
(unwittingly) that should have been 2D and then use that variant to create a
LightweightPolyline object didn't have the outcome I quite expected.
"What the...?!" :-@
I tracked down the trouble in a 'Point/Vector addition' subroutine, which
automatically converted and then later output my 2D point list to a 3D point
list - which wasn't what I wanted to do in this case. I fixed it for this
particular problem, but I think it could be better.
So I was wondering what you people do to keep the dimensions correct - and
*especially* if you may be working with 'mixed dimension types', such as
adding a 2D xy vector to a set of 3D xyz points. If you use mapcar '+ for
this, you end up with a 2D pointlist when perhaps you really need those z
values.
When doing this type of point manipulation, have you found it best to
define/use a series of routines, like '1dVectorAdd', '2dVectorAdd',
'3dVectorAdd', etc. - OR - would it be better to create and use one routine
'VectorAdd', along with a desired output 'dimension' argument, perhaps like
(VectorAdd _vec _pts 2) - so that no matter *what* the input vector or point
list dimension happens to be, the output will be as indicated?
I'm leaning toward the second, since it seems to be a more 'all-encompasing'
solution (and fewer routines to keep track of), but I don't know if that
neccessarily results in better - faster/more readable/etc. - or worse code.
If this seems like a silly question or just a rehash of old topics, forgive
me, I've been gone awhile and feel a bit out of practice.
Mind you, I'm not necessarily looking for actual code, just some
opinions/reasons on what you consider to be good coding practice for this
sort of thing.
Many thanks,
David Kozina