How to change the vanishing points (P1,P2,P3) in the perspective in MATLAB 3D figures?
Below there is a scheme of explanation what I mean:
Thanks in advance for your help.
If you want to control the perspective appearance in a plot, you'll want to first change the Projection property of the axes to perspective. Then you can change the various camera properties of the axes to get the view you want. The important ones for adjusting how the perspective looks are the CameraViewAngle and CameraPosition.
I have found that a "realistic" perspective view can be achieved using a CameraViewAngle of about 30 degrees, mimicking the preferred viewing area of the human eye:
The default CameraViewAngle is about 6.6, so setting it to 30 will cause the view to appear zoomed-out. You will then want to change the CameraPosition so that it is closer to the CameraTarget, thus zooming the view back in. You can use a larger CameraViewAngle if you want a more exaggerated perspective (like a fisheye lens).
Related
I created a body-locked toolbar like in this gif (link to better quality). Therefore I used the scripts Solver Handler and the Solver Body Lock:
Now I want that this toolbar collides with the environment and does not go through walls, because right now my toolbar goes through everthing. I read that you have to use the Solver Surface Magnetism but the only thing I found are guides to align an object to the surface so it sticks to it. But thats not what I want. Here is an example with the HoloLens menu, how it behaves (link to better quality):
My Question: How can I achieve that my toolbar behaves like the menu of the hololens, so it does not go through walls/environment?
I think you can change the Orientation Mode in the Surface Magnetism solver to None to achieve the effect your are looking for.
There's probably something to do this already in MRTK but I'm not sure...
I'll have to do something like that soon and I was thinking of implementing some logic myself, maybe use one ray from each corner of the toolbar towards the camera and if any hits the space mapping layer adjust the position until all four corners are visible or something of the sort... search a suitable position and Lerp the position there maybe?
I use the Leaflet plug-in "Leaflet.ImageOverlay.Rotated.js" to use its L.imageOverlay.rotated(...) thing in order to overlay certain map pieces in various places on top of the normal map.
It does this by taking an image and having me tell it its top-left, top-right and bottom-left coordinates to figure out how to rotate, tilt and stretch/squeeze it properly.
It took me a very long time to figure these coordinates out by hand. For this reason, I'm looking for some sort of "geopositioning mode", perhaps enabled by this extension, which would simply let me click three times on the map to tell it where these points go. That would be so simple for the developers to do and would help so much. It's such an obvious thing to do that I strongly suspect it's already implemented and ready.
Is there such a "mode"? If not, how am I expected to find the positions without spending so much time and trial-and-error as I did for the first overlay map image?
Added: I should also clarify that the image should be shown in this mode so that you can re-adjust the points and watch in real time as the image bends/warps, to get it just right.
you can develop a modul for this problem.
find minimum 4 point on raster map.
click on tilemap for 4 points
than find different slope and distance same 2 points.
maybe you must rotate and use affine transformation.
when rotating a 3D-plot in Matlab one can only rotate completely, so full 360°, around the z-axis (azimuthal angle) but only from +/-90° around the x/y-axes (elevation angle). I know that this includes all possible views in a spherical coordinate system, yet, a customer of mine would like to have the same functionality like in Fiji (3D-Viewer) or similar 3D-Viewers, to rotate fully about the 360° around an arbitary axis.
As simple demo:
surf(peaks); rotate3d on
I thought of a handles listener with callback when the view changes and then adjusting the azimuthal and elevation angles accordingly to generate the feeling of a full rotation but maybe someone has a better and simpler idea :)
Cheers Mika
I found a possible solution:
One can enable the camera control toolbar and use the camorbit functionality which does exactly what it should. In my GUI I just enable/disable it via a custom toggle button in the toolbar like so
if strcmp(get(handles.uitoggletool5,'State'),'on') == 1
cameratoolbar('SetMode','orbit');
else
cameratoolbar('SetMode','nomode');
end
I have several plots on one figure. One is a 3D plot, the rest are 2D. When I select Zoom on the toolbar, left clicking on the mouse uses the zoom.m functions, and in 3D, it looks like it uses camzoom.m. However, when I right click to bring up the context menu, the "Reset to Original View" looks like it only works on the 2D plots. For the 3D plot, selecting this either does nothing or it loses the x-axis limits, and therefore the plot shows no data points (I can't get it to work consistently).
I'm trying to come up with a workaround for this problem.
I would like to override the context menu for just the 3D plot with my own function that would redraw the plot, and leave the default context menu for the 2D plots. Is this possible? I'm thinking no, as there is only one zoom object for the entire figure, and MATLAB does not let me set the handle to the context menu while zoom is on.
Is there a way to get around this problem? It looks like an oversight on MATLAB's part to not have this function correctly!
I am trying to created a vertical menu (on the left side of the screen) which I can display and hide using a gesture recognizer.
I have found a post similar to this which helped slightly, but all it did was rotate the UIToolBar to a vertical position without changing the width or position.
If anyone has succesfully created something similar to this and is willing to help I would greatly appreciate it!
Also, if anyone can point me in the right direction possibly to some sample code I would like that as well.
You could do this with a UIToolBar by applying a 90 degree rotation transform, and then having all your icons rotated 90 degrees to match - you can change the width and position simply by adjusting the UIToolBar frame. However, you will need to create your own toolbar to do this rather than using the built-in one you get with a navigation controller.
Another option is simply to roll it yourself: this will allow you more customisation, so is perhaps the better option. There are a number of third-party implementations of varying types, some based off the current Facebook App side-bar, a good place to start looking is http://cocoacontrols.com - they are of varying quality.
On the other hand, it wouldn't be too difficult to roll your own, so that's a good option to consider.