Hello
I am starting a course project in optimization of a robot movements in a confined space. It is a 2D approximation. The factory floor is to be modelled with polygons and arcs. The robot is represented with a circle. Its path is also to be constructed with lines and arcs. The problem is to find the shortest path from one location to another which avoids any collision.
I have done some mathematics for it, but I need a visualization and testing application.
I am totally new. Would anybody have suggestions about the right way to approach this?
The first question I have is how do I draw the 2D scene?
Thanks in advance
Joey
Simulation with arcs and polygons
-
- Posts: 121
- Joined: Mon Apr 04, 2016 4:55 am
Re: Simulation with arcs and polygons
Hi Joey
It looks like the easiest way is to use 3D wires with all z coordinates set to zero to model a single curved arcs/lines polygon. Have a look at BuildWire() in the main form Shape Builder sample.
Instead of bspline curves you can use circles or lines for the edge curves. See ShellBuilder.UpdateCircularEdge() method in the same project.
There are different ways of simple construction of straight edges. Like you could construct the whole wire from the polygon corners as straight lines using IBRepWire_DG.InitFromPoints(IPointArray_DG points, bool closed) and then change curve of arc edges via IBRepEdge_DG.SetCurve(ICurve_DG curve)
To force the view to act as 2D:
Reset view orientation so the viewer will look from the end of z axis:
Disable interactive rotations of the view:
Cheers
It looks like the easiest way is to use 3D wires with all z coordinates set to zero to model a single curved arcs/lines polygon. Have a look at BuildWire() in the main form Shape Builder sample.
Instead of bspline curves you can use circles or lines for the edge curves. See ShellBuilder.UpdateCircularEdge() method in the same project.
There are different ways of simple construction of straight edges. Like you could construct the whole wire from the polygon corners as straight lines using IBRepWire_DG.InitFromPoints(IPointArray_DG points, bool closed) and then change curve of arc edges via IBRepEdge_DG.SetCurve(ICurve_DG curve)
To force the view to act as 2D:
Reset view orientation so the viewer will look from the end of z axis:
Code: Select all
IView_DG iView = m_dgk.GetView() as IView_DG;
IFrame_DG iEyeFrame = iView.GetEyeFrame();
iEyeFrame.ResetOrientation();
Code: Select all
IView2 iView2 = iView as IView2;
iView2.Enable(EEnableBit.eEnableRotate, false);
-
- Posts: 121
- Joined: Mon Apr 04, 2016 4:55 am
Re: Simulation with arcs and polygons
Starting from update 5206 the second part can be also done as:
Code: Select all
iView.SetBoolAttribute(ViewBoolAttribute_DG.eViewBoolAttributeDgEnableRotate, false);