How to use rotate 3D in a matlab figure without losing focus? - matlab

So basically, I'm using matlab to simulate several lines and points in a plot3 figure.
When I'm trying to navigate the result using then "pan" command, I want to focus on a particular part, but EACH time I try to rotate around the point I'm focusing, I lose the focus and it rotates around the center of the figure. Is there any way to keep the focus when switching between commands to rotate 3d?.
When I use zoom and then I use pan, I don't lose the focus.
When I use pan and then I use zoom, I don't lose the focus.
When I use pan and then rotate 3d, I lose the focus, and I rotate around the center of the plot/figure.
When I use zoom and pan and then rotate 3d, I lose the focus, and I rotate around the center of the plot/figure.
Is there something wrong with the rotate 3d command? Is there an option I can change?
Thank you!

Related

Modifying smooth curve with Anchor points

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.

Matlab: Full 3D-Rotation with elevation higher +/-90

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

Keep touchZoom centered?

I am using Leaflet in a mobile app and want to get rid of the two zooming buttons in the top corner, but I need the exact same effect (zooming without the possibility of panning around with it) but using a pinching gesture. Alas, the default pinching gesture does not keep the view centred!
I don't know why, but keeping the zoom centred when using the mousewheel or doubleclick are available options for the map object:
If passed 'center', double-click zoom will zoom to the center of the view regardless of where the mouse was.
If passed 'center', it will zoom to the center of the view regardless of where the mouse was.
But not for touchZoom, I tried. maybe the nice people at Leaflet thought the effect doesn't "feel" nice, but I really wish I could try it nonetheless and judge it by myself.
Anyone knows how to get a similar effect? I don't really want to end up calling setView() at every "zoom" event call, if that even was an option...
Found out that I could use the maxBounds option. If you set both corners on a single point (the one you'd use for setView, for example), the map won't be able to pan away from it.

How to pin mouse in center of screen with GLUT?

I want to pin my mouse in middle of screen I mean when user move mouse the only thing that he see is rotation in environment also mouse cursor never reach window border ...
I want to handle my camera with mouse but when mouse reach window border or in full screen mode screen border the mouse position doesn't change but camera should still rotate slow or speedy depend on speed of mouse movement...
How should I solve this problem?
SDL_warpmouse can accomplish this. If you are looking for an OS-specific way to accomplish this, consider viewing SDL's source code.

Best way to animate a spinning wheel thats responsive to touch events

I need guidance towards the right direction to take here.
I want to build a spinning wheel control where a user can select an element.
I want to accomplish the following:
Receive touch events that will rotate the wheel based on the finger position in touchesMoved
Magnify the image that is inside the selected image indicator when it passes through.
I was thinking of a core animation Basic Animation and animating the rotation.
Using an animation group and rotate it around.
Problem 1:
How do I sync the animation to the touch events.
Problem 2:
How will I know which image is the one I need to magnify with for example an CGAffineTransformMakeScale.
Is there a best practice for my problem. Esp. with performance in mind?
http://img24.imageshack.us/img24/8596/imagezy.png
You can achieve this by update the wheel for every touchmoved event.
For each touchmoved, touchbegin event, you can know the angle of the line from center of the wheel to your finger. You save your begin angle, then you will know the diff angle. The wheel can rotate depends on your finger by using angle.
you can enlarge the image icon by either of these two ways.
1. You can know which image icon angle in all the wheel, and you also know current angle of the wheel. So, if the image icon is between the right angle. Ex. if wheel is at 45 degree, then icon at -45 or 360-45 degree will be enlarged.
2. check the y origin of each image icon, if the image icon origin y is above threshold.