Comments (4)
Unfortunately, converting from double (DoublePoint) to float (PointF) is a
information-losing conversion, and Microsoft's guidelines say that should not
be done automatically.
Similarly, the removal of IntPoint and DoublePoint would be a breaking change,
which should be done carefully, if at all.
Language-lawyer tendencies assuaged, I'd vote for breaking changes over
automatic conversions between various functionally equivalent structures.
Failing that, I'd also vote for truncating doubles to floats automatically.
If you (AForge devs) are opposed to such things, extension methods to convert
IEnumerable<IntPoint> to IEnumerable<Point> and IEnumerable<DoublePoint> to
IEnumerable<PointF> would make the array/list of points issue less problematic;
it's easy enough to take an IEnumberable and convert it to the desired concrete
class. Or to just use it as an IEnumerable.
Original comment by [email protected]
on 12 Oct 2010 at 4:09
from aforge.
I really agree that the fact AForge.NET framework has its own IntPoint and
DoublePoint structures may look awkward and introduce pain. I can explain why
they came ...
I simple don’t get why MS decided to put Point and PointF into
Systtem.Drawing namespace. Why should I reference this assembly and use this
namespace if don’t want to draw at all? What if I want to create some
math/geometry/whatever routines, which deal with points, but not with drawing?
Well, maybe the above though is not an excuse to introduce such awkwardness,
but putting point structures into System.Drawing is not the best idea either.
Original comment by [email protected]
on 10 Nov 2010 at 10:51
from aforge.
The reasoning behinds the decision to provide custom point structures outside
System.Drawing makes sense. However, I think it would be useful to provide more
of the methods implemented by System.Drawining.Point/PointF, in particular the
Empty property to return a zero-valued point, and methods for truncating,
ceiling and flooring a Point/DoublePoint. They could be marked as
[Serializable] as well.
By the way, wouldn't it be better if X and Y were exposed as properties instead
of public fields? Those would be optimized by the compiler anyway.
Original comment by [email protected]
on 14 Apr 2011 at 2:20
from aforge.
>> However, I think it would be useful to provide more of the methods
implemented
>> by System.Drawining.Point/PointF, in particular the Empty property to return
>> a zero-valued point, and methods for truncating, ceiling and flooring a
>> Point/DoublePoint.
Yep, could be done. You can even submit a patch for this ;)
>> By the way, wouldn't it be better if X and Y were exposed as properties
>> instead of public fields?
We may do it. However the benefit is not that obvious in this particular case.
Cannot imagine any type of extra code someday appearing in setter. (Take a look
at XNA code - MS does not bother to create extra properties for simple
structures like Vector3)
>> Those would be optimized by the compiler anyway.
Only JIT compiler may do it.
Original comment by [email protected]
on 17 Apr 2011 at 9:54
from aforge.
Related Issues (20)
- Unable to detect object after changing the angle of abject which was different while training object. (getting diff. dimentions) HOT 4
- Add support for 32-bits ARGB images in the CornersMarker filter HOT 4
- Slow performance of PermutationChromosome.CreateChildUsingCrossover HOT 5
- Rotation Invariant Template Matching in c#.net HOT 3
- PointedColorFloodFill causing Stack Overflow HOT 4
- Deadlock with out-of-order calling of VideoSourcePlayer.WaitForStop and VideoSourcePlayer.SignalToStop. HOT 3
- AForge.Math.FourierTransform.FFT unhandled exception HOT 4
- MJPEGStream could handle incorrect boundary values HOT 3
- XML documentation files are not included on default installation HOT 2
- IAMCameraControl support and Microsoft LifeCam frame size fix HOT 5
- Blob Detection problem with certain aspect ratio rectangles. HOT 7
- IsQuadrilateral can return true on U-shaped blobs. HOT 1
- *Point.DistanceToLine method HOT 13
- Converting an Image between Rectangular and Polar Coordinates HOT 7
- Blob no longer has a constructor? What happened? How does a blob get instantiated with data? HOT 4
- Find line intersections HOT 3
- Math.Tools.IsPowerOf2 returns true when given 0. HOT 3
- Contrast issue HOT 2
- Distance and Similarity metrics HOT 28
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aforge.