Polygon creation in OpenModelica - modelica

While creating a regular polygon in the Icon/Diagram Layer in OpenModelica, I can understand that the origin is the centre/centroid of the polygon and the co-ordinates of the points of the polygon are calculated using the origin as a reference.
Can anyone tell me how the origin co-ordinate and the point co-ordinates of an irregular ploygon are generated in OpenModelica?

Each graphic shape has a bounding rectangle http://qt-project.org/doc/qt-4.8/qgraphicsitem.html#boundingRect. The center of this rectangle is used as an origin.
What do you want to achieve?

Related

How to "correct" the roundness of the earth leading to ellipsis instead of circle in react leaflet

I'm trying to programatically "draw" a circle with multiple Marker with React leaflet.
I'm doing it with cosinus and sinus trying to calculate theirs coordinate from the center point ...
But the more I'm near the pole the more the circle is an ellipssis ... Is it a way to transform the calculus to take this into account ?
In this example I'm in Oulu (near the pole) If you just change the x var into '0' you'll notice that the markers are now in circle !
please see this CodePen
Because a Leaflet map is a projection of a sphere onto a flat map, distortions will happen near the poles. You want to project your spherical Lat/Lng into flat Points, calculate the marker placements in flat Points and then unproject the points back to spherical LatLng.

Display Earth map in Azimuthal Equidistant Projection

I have to display the Earth's map in azimuthal equidistant projection, by giving the lattitude and longnitude as input in Matlab. I am using the eqdazim projection, but I am still getting the map with point (0,0) in the center. I want to be able to change the point that is the center if the circle map.
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('eqdazim', 'Frame', 'on');
geoshow(landareas);
Also, I don't know how to change the radius of the image. I don't need the circle with the whole Earth but instead something about ~2000km radius around center point.
I need it in order to put its image on a dome. Below is a simple example with such a dome and random fragment of the Earth's surface. Keep in mind, that it's just an image that I cropped manually from large Mercator map.
I was hoping that I can use the Mapping Toolbox in order to get such a map automatically, by giving lattitude, longnitude and radius. I have all necessary data, which is:
Lattitude & Longnitude
The radius of the circle
I just don't know how can I get this part of Earth's map. I think I have to use the azimuthal equidistant projection. I just don't know how to do this in MATLAB/Mapping Toolbox.

Rotating an arbitrary polygon around its own center

I'm trying to find a way to rotate an arbitrary polygon around its own geometric center. It was drawn in a blackboard built with creating js.
I've been trying many approaches, but any of them has worked.
How can I accomplish it?
Find the geometric centre as the average of all the points' coordinates. Make all the points relative to this centre (such that the centre is (0,0)), then rotate them by the desired angle using a rotation matrix. You can then draw using these points.
This is assuming you have the coordinates of all the points.

matlab: how do create a projection

I want to create a perspective projection of a 3D image onto the x,y plane with a focal length of 10 and a principal point (-1, -5).
I found:
view
viewmtx
But I do not get how to tell matlab that I want to use the x,y plane nor how to set the focal length? Can someone explain me how to do that?
I'm afraid you are not looking for the right functions.
The view function does only change the point of view on the current axis, while viewmtxreturn a transformation matrix.
You may want to do something similar to what it is discussed on this post How do I draw a texture-mapped triangle in MATLAB?, where maketform and imtransform are the key functions to get a plane image reprojected into another certain 3d plane.

Plot 3 D cube around interest point in MATLAB

I want to plot 3D cube of size 2x2x5 (x,y,z) around an interest point to get the nearest points to it and inside the cube. The interest point may be at the center of cube.
How can I get the nearest points to the interest point?
There are several techniques for drawing cubes here. You will need to choose one that lets you specify size and origin. The sizes will be 2,2,5, and the origin will be the coordinates of the interest point.