How to find out if two shape objects in PowerPoint intersect with each other? - powerpoint

There are multiple shapes present in a PowerPoint slide. See image below
As can be seen in the image, we have 3 shapes - rectangle, triangle and circle. I would like to iterate over the shapes in the slide and create a list of shapes for each shape with which it intersects. Shape intersection here refers to actual visual shape intersection and not the rectangular bounding box around those shapes.
List 1 - triangle, circle
List 2 - circle, rectangle
List 3 - rectangle, triangle
Is there any API to determine shape intersection? I have checked the PowerPoint add-in API, haven't found any. What approach should I follow?

There is no API to determine the shape intersection. You need to use Shape's properties to find out and intersection with others. A similar questions was posted some time ago, see List of objects in front of an object in PowerPoint using VSTO for more information.

Related

How to find square shape from a list of points?

I'm trying to write a small drawing app where I want to be able to draw shapes by hand and the app will identify the kind of shape and redraw it using vector graphics.
Supposing that I have a list of 2D points that represent the following image:
What algorithms should I use in order to:
Determine that the shape is a square and not another shape or curve/arc;
Determine the edges of the square

How to cover a rectangle area with irregular shapes and no holes

I have detailed, highly irregular shapes like these:
and I'm looking for a way to make them cover a rectangle area with no holes and minimal blend/cover between shapes. Limited up-scaling and free rotation is also allowed.
I searched through packaging and covering algorithms but there is not a lot of information about irregular shapes and every one I looked at assumes shapes cannot blend. In my case this is acceptable.
Given above shapes one solution would look something like this:
To achieve above result shapes have been transalted, rotated and scaled.
Given:
All shapes can be scaled up and down (max 2x) and rotated
Shapes can overlap
Part of shape can be outside of rectangle
Shapes don't have holes in them
Do you know an algo that could solve this?

Algorithm for a "Blob" Border

I have several 2 dimensional circles that I want to draw a border around. I've done this using a convex hull before, but my goal is to make the border almost like a surrounding "blob". I attached a picture to show what I mean.
Essentially, I want the border to outline the circles, and be pulled slightly into the middle of the area if no circles are present. The center shape shows my current train of thought -- create normal lines for each circle, and somehow merge them into a complete shape.
Summed up, I have 2 questions:
1. Are there any existing algorithms to do this?
2. If not, are there any algorithms that would help me merge the circle outlines into a single larger path?
Thank you!
"Everything You Always Wanted to Know About Alpha Shapes But Were Afraid to Ask" is for you http://cgm.cs.mcgill.ca/~godfried/teaching/projects97/belair/alpha.html
One way to get this border could be to simply compute the distance to the centers of circles: for a given point this distance is the minimum of the distances from this point to all the centers of the given circles. Then sample this distance function over a regular grid. And finally extract the f-level of this function as a collection of polylines with an isocurve extraction algorithm (like Marching Squares). f should be the radius of the circles augmented with the desired margin.

How to fill a rectangular area with non-intersecting rotated rectangles?

I try to create a scene for physical simulation. The scene consists of rectangular floes floating in a rectangular pond. Something like this:
So I need to fill a rectangular area with non-intersecting rotated rectangles with widths and heights in a specified range. I don't need to find an optimal coverage of the area. The goal is just to generate floes of different size without intersections.
And I'd like to get a solution without any dynamics, only using collision detection algorithms.
You could consider simulating a collection of boxes falling into a square bucket and saving the positions of all the boxes once they come to rest.
box2d is an open source 2D physics library that can do this for you - you might recognise it as the physics engine behind Angry Birds and umpteen-million Flash games.
There is what I would do:
Suppose the length of the rectangles are between [MaxSize MinSize]
r <- MaxSize
do{
Trying adding non-intersecting circles to the area with radius r and random center (x,y). We use circle instead of rectangle because intersection detecting for circles are easier than rectangles. e.g. if distance(x,y,x',y')<r+r' then we are good.
If adding circle failed{
r--;
if r< MinSize break;
}
}
Now you will have a plane full of on intersecting squares. There will be gaps because we were using circles as intersection detection. If this is not good enough for you, grow the squares to rectangles. You can do this by checking all points against a certain border and decide how much you can grow it.
To model solid (ie non-intersecting) objects, you could use a physics engine. As it happens I just the other day read Farseer tutorial for the absolute beginners, which includes a video depicting almost exactly your requirement. Farseer is a .NET version of box2d, which you may have heard of.

Filling the area inside of a irregular shaped polygon in opengl es

I have a set of points that outlines my polygon. The polygon can have many different shapes including convex shapes (imagine the shape of a crescent moon). I thought I could fill the inside of these shapes by using a triangle fan that started at the first point on the perimeter, but this fails badly on certain shapes.
How do people get this done? I wish there was a glPaintBucket function.
I believe you need to use the (intrinsically filled) triangle primitive after breaking up your polygon into triangles (start here to learn about polygon triangulation).

Resources