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
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 wish to emulate this effect in Xcode with Swift. After some research I managed to find some articles about drawing smooth curves using a set of points .But I am still unclear about how I could to dynamically modify curves when the user touches/holds the screen.
Question :
I know how to make a smooth Bezier curve, but how can I add gesture recognizers such that by dragging the curve its shape changes.
I only need someone to point me in the right direction. Is there a guide or article in particular that could be useful?
Create transparent ControlPointView for every control point of the curve with a size of 50*50pt, so that users can easily tap them and drag.
Add a small image in the middle of every ControlPointView, so that users can see where the control point is located.
Add UIPanGestureRecognizer on every ControlPointView and handle it in view controller.
Use centers of control points to rebuild UIBezierPath every time gesture recognizer's state is changed.
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).
I have configured Core Motion manager in order to access the rotation coordinates and use them to animate deviation, like in native compass application. So here is what I want to achieve:
It is this green line showing the deviation. I've tried simply to animate bezier's curve by setting it in
manager.startDeviceMotionUpdates(to: OperationQueue.current!, withHandler:)
method, but it didn't work - the animation was starting each time coordiantes was changing and filling the center with lines. I suppose that this animation should run on different thread, and motion manager should update only end point of bezier's curve. I have no idea how to do it. Any tips or examples would be appreciated!
I'm making some figures in Matlab, many of which I'd like to print at different zoom levels. The figure is made using subplot. Each subplot has its own title, but I also want a larger title for the entire figure.
The problem is this: once I add a supertitle, the figure no longer pans or zooms. If I remove the supertitle with supertitle(), then I can once again pan and zoom. The brute force solution to this problem is to continue toggling the supertitle on and off while I pan and zoom in between, but this is both time consuming and irritating.
Does anyone know a way to restore the pan and zoom functions while keeping the supertitle of a figure?
AFAIK, supertitle() is not an in-built function in MATLAB and is not shipped with the common toolboxes from Mathworks. This is probably a custom function file that extends MATLAB's plotting capabilities.
That said, the error is most likely due to the function not returning focus to the original plot which makes zoom & pan to not work as desired. The exact reason can only be figured out by looking at the original code.
Try panning and zooming programmatically, rather than using the GUI controls.