Polygons collision detection silverlight - silverlight

This is not a generic question on collision detection, so please read it till the end.
In my wp7 game, i represent all my objects as rectangles, and use the the Intersect() method to check for collisions between 2 rectangles, which works great.
I was thinking of enhancing the accuracy by drawing the objects as polygons instead of rectangles.
Is there a built in api such as the Rect.Intersect() that works for Polygons ?
More generic question: Is there a better approach other than the Rect.Intersect() one which utilizes .net api's and does not involve implementing collision detection algorithms?

There is no baked in equivalent for polygons collision detection in silverlight. There is a similar question asked here. But there is a Polygon Object JIC you didn't already know

Related

How to find obstacles in horizontal surface using ARKIT of iOS 11(Scenekit)?

I am working on a POC using the sample provided by apple https://developer.apple.com/sample-code/wwdc/2017/PlacingObjects.zip.
Right now placing object works fine after detecting the surface. But when i move the object from the detected surface to some other space like walls or some obstacle, it is overlapping with the 3D object.
Is it possible to detect the obstacles while placing/moving the 3D object through camera? Is there any sort of API available in ARKit to find the obstacle in the surface?
If not is there any workaround or calculation that we can do to find the obstacle/wall and let user not place/move the object above/beyond the obstacle/wall?
The short answer at this stage is no, unfortunately.
Detecting vertical planes, or objects in a scene, is quite difficult. My understanding is that Apple is working on vertical plane detection, and that there are a couple of startups doing the object detection stuff.
The best option will be to wait for 6d.ai, as this is what they are working on (although they are in stealth so hard to tell exactly).
If you have any Core ML experience then you could use an object detection model (find a third party one) to recognise objects in a scene and use that as a proxy for geometry that is off limits. There's also Matroid which provide object detection / tracking capabilities.
The following are not specific ARKit / iOS examples, but might help you later on.
Vuforia has support for scene understanding: https://library.vuforia.com/articles/Training/Getting-Started-with-Smart-Terrain
Hololens sort of has support for it as well: https://elbruno.com/2017/04/21/hololens-spatial-understanding-vs-spatial-mapping-and-a-step-by-step-on-how-to-use-it/

WPF fast 2d plotting...what to use?

I've got an application where I am processing images from a camera at around 20Hz. Each image is segmented into a matrix of regions, let's say 100 x 50 (for example). Each region is processed, resulting in a single floating point metric. I'm trying to create simple 2d plot for each region's data as it is created. So, on the screen would be a matrix layout of 500 (in this worse case example) plots/charts.
I'm currently processing the images without issue using managedCUDA and writing some CUDA kernels to take care of that. What I'm faced with now is trying to create a way to logically view all this data has it's coming in. Things I've considered:
Building an "image" on the gpu with dimensions matching the target display control. This image would be segmented into the appropriate number of regions and a rudimentary chart would be drawn, pixel by pixel.
Learn Direct3D or OpenGL and code the algorithms necessary to draw the charts
Use the native WPF capabilities to draw the charts myself.
Use a commercial or open-source charting tool
Option 1 seems crazy to me (but I had a gpu-centric friend suggest it).
Option 2 seems like I'd have to learn all the unnessary 3D overhead of D3D or OpenGL just to draw 2D plots.
Option 3 and 4 probably have the most appeal to me, but I'm worried about performance.
So just looking for advice before I charge off in one of these directions.
I thoroughly recommend SciChart if you have the money. We develop scientific software that need to process large amounts of data being received from external devices, and have found SciChart to be excellent (features and performance). And no I'm not affiliated to them in any way!
Like all charting components it takes a while to get your head around the many features, but it's worth it. If you download their trial it includes a load of samples, including demos of real-time performance.

WPF real-time rendering

I'm designing a game and thinking about using WPF for making a simple prototype of the basic gameplay.
Is it possible to render basic 2d-graphics in WPF in real-time? By basic graphics I mean simple shapes such as lines, circles, etc. By "real-time" I mean things are rendered based on parameters such as velocity, acceleration, etc. that changes depending on player input - which I assume means I can't use storyboards for the animations.
Thanks
Check out the previous question High Performance Graphics using the WPF Visual Layer for a good related discussion. While WPF provides a great framework for rich vector graphics, it lacks somewhat for real-time 2D performance.
There are workarounds, for instance, depending on your scene complexity you may get away with using DrawingVisuals or virtualized Shape classes (WPF Vector graphics) to draw your sprites. Going a little lower level, you could cache sprites using the BitmapCache mode available in .NET4.0, or pre-prendering them to Bitmaps and using various optimization patterns to improve throughput.
Going lower level still, you can mix Vector/Raster graphics using the fantantastic WriteableBitmapEx project, or Vector/GPU graphics using the D3DImage.
Regarding how to update your scene, you'll need to write a primitive game engine where on the CompositionTarget.Rendering event (fired on redraw of the screen) you get the updated parameters and compute positions/orientations of your sprites. Something that might help with this is this great codeplex project which integrates WPF/Silverlight and Farseer physics.

What can I use to make an ROC Curve in WPF?

I want to make a graph of several ROC curves in WPF. I've found the WPF Toolkit, but I don't see an out-of-the box solution for what I want, just several basic graphing types. Is it possible to build an ROC curve (preferably, an ROC convex hull curve) in the WPF Toolkit? Once it's built, is there an easy way to get the AUC? Or is there an off-the-shelf solution I can just use?
Basically, I want a graph that looks like these graphs, but nicer and scaling with resolution.
It seems to me that you'll need to learn using WPF PathGeometries. I haven't used them much, but from what I learned, I think it's possible to do the ROC curves.
If you want scaling, resolution, zooming. I think you'll be better of getting something that is already done like Telerik, Infragistics, DevExpress or ZedGraph. Otherwise you're likely to spend a lot of time implementing it yourself.
I used ZedGraph to create nice ROC curves, even with the color scales at the side.
It is not so hard to do, you just need to use ZedGraph's custom LineObj objects.
Here's example of using ...Obj objects in ZedGraph (you can add LineObj to the chart just as it is done with TextObj or ArrowObj there).
I went with the visifire controls, and then added in a first series for the points and a second series for the convex hull.

Where to learn proper way to use Silverlight (or WPF)

Approaching Silverlight development is a rather daunting task as it seems to require a rather different mindset to work I have done in the past.
I have been working on it for several months and we have already released an application that presents form-based pages. So I have the basics of XAML for layout but what I need to do now is move into graphically representing data. For example transform a list of objects representing vehicle speed recordings into a line graph of speed. I am at a loss on what the best way is to approach this.
Can anyone point me to articles or tutorials that present this kind of thing?
Your first port of call for Silverlight learning should be the official site http://silverlight.net/Learn/
If you want to do any data visualization/charting then first try the Silverlight Toolkit on codeplex. It's fantastic if you want to get anything up and running quickly.
Also check out Delay's Blog on charting and the chartbuilder code
Bang your head against it for 3-6 months. That's how I did it and it's worked out pretty well so far.
But seriously, the learning curve sucks.
There's charting libraries for Silverlight out there, you could grab one of those but I wouldn't waste money on it. It's relatively easy to write this kind of code yourself.
All you really need is a DrawingVisual. Once you have that you can render what you need on to it's surface. The trick is to make sure that you have sufficient layout information when you render. Because this is vector graphics, you can use the ScaleTransform to match your content bounds instead of repainting on size changed. Other than that, you'll wanna host your DrawingVisual in a UIFrameworkElement and let the dimension of that object govern where and how you draw your data. This will give you all the layout goodness of WPF/Silverlight.
For drawing there are plenty of Geometry classes you can rely on but there's one thing that you'll wanna do and that's to adjust the level of detail in your data points with respect to your drawing. This is the number one trick to make sure you don't hog the CPU.
Avoid drawing more than one data point per pixel. If you have a lot of data points, and a small drawing surface you can use a rolling average to smooth the result.
If you approach this with the above things in mind you should be able to write a flexible graph UI element that you can visualize data with, in no time at all.
I did this in a WPF application, I'm pretty much assuming that you can do the exact same thing with Silverlight 2.0, you'll just yell at me if you cant?

Resources