How to toggle axis for local selection in edit mode - user-interface

I have a typical Blender problem: I accidently have toggled these axis that appear on every selection in edit mode. How to toggle them back?

Origin to 3D Cursor (Object » Set Origin » [option]) to reset the origin to wherever the 3D Cursor is located in the Scene;
Geometry to Origin: reposition mesh relative to Origin.
Origin to Geometry: repositions Origin relative to mesh.
Origin to 3D Cursor: repositions Origin at 3D Cursors location.
Origin to Center of Mass (Surface): resets Origin based on total surface area.
Origin to Center of Mass (Volume): resets Origin based on bounding box volume.

Related

Rendering a viewport to a sprite's texture only gets one quarter of the rendered image. In Godot

In the right side I have the Viewport object that renders the OriginalImage.
Then in the left side I have a Sprite whose texture is the output of the Viewport object.
When running the Scene, I only get one quarter of the image, no matter how I place or offset Viewport, Camera, Sprites, etc.
For more information, please check the repo and of course pull requests are welcome:
https://github.com/Drean64/godot-viewport
Offset'd the Camera to the center of the viewport, because it was otherwise centered at the viewport's origin.
https://github.com/Drean64/godot-viewport/commit/ccfd095eb4bc23e2c5f385a35921280b878ee3d7

Set object center position at world origin

I loaded a .obj earth and I'm trying to perfectly center it to the world origin. By "center it to the world origin" I mean I want the object exact center to be at the world exact center (0, 0, 0).
I know I can use a bounding box to get the center of the object and then maybe translate the whole object by minus that amount but is there a simpler way to do this ?
When you add a mesh to a scene, it is automatically added at the origin.
The bounding box way is non-destructive to your geometry, so if your shape has an offset built into it, you won't lose that. It's also "easy" because a majority of the processing is in finding the bounding box initially, and then that box doesn't change unless you scale or deform the shape.
There is an alternate way, if you don't mind your geometry changing: mesh.geometry.center(); will shift all the vertices such that the shape's geometric origin is at the mesh's origin (and if your mesh's origin is already at the scene origin, then you're good to go).

Button on Graph point in Core-plot? Objective-C

I'm currently working on a project where I present several circles in a graph, where some circles are dependant others. I have 1 circle which has its origin in (0.0, 0.0), and another circle (let's call them circle1 and circle2) which has its origin on an angle position on circle1. So I calculate the origin position of circle2 by deciding an angle and calculate that angle towards circle1's local graph. By doing this I get an x and y position for a specific angle in the local graph for circle1. On the point (x, y) I then draw circle2.
However, I would like the user to be able to interact with circle2. More precisely I want to be able to change the angle from which circle2 was drawn by adding some sort of slider, which on the user drags in order to change the angle and then redraws the circle2.
Clarification: What I want to do is to add a button to the HostedView and drag it around in the view. Is this possible in Core plot?
You can't add buttons or other views to the Core Plot hosting view. Add it to the hosting view's parent view and position it on top of the hosting view.

Cast shadow in a specific orthographic area

I want to create a SpotLight such that the shadow map covers a specific orthographic area, or a PlaneGeometry. The default settings however appear to create a shadow area based on the frustrum of the light. Given that the frustrum is rotated and scaled compared to the plane, it is not possible to simply alter that frustrum. I'd have to make it very large to cover the intended area, and then the resolution is low.
Is there some way to create a light for which the shadow is calculated on a specific recipient area (either a plane or an orthographic region)?
You should create a second spotlight which is child of the first spotlight and position set to 0,0,0. And you should set the target to the plane. And onlyShadow set to true.
That way you can have the second spotlight pretending to be the first spotlight but with a detailed shadowmap.
EDIT OLD ANSWER (misinformed):
It is possible to use a directional light to create an orthograpic
shadow.
https://github.com/mrdoob/three.js/blob/master/src/extras/renderers/plugins/ShadowMapPlugin.js#L169
This directional Light can be set to be onlyshadow.
https://github.com/mrdoob/three.js/blob/master/src/lights/DirectionalLight.js#L16
The expected frame can be set with the shadowCamera.
https://github.com/mrdoob/three.js/blob/master/src/lights/DirectionalLight.js#L20-L26
And the angle can be set with setting the position to the calculated
normal of the plane.

Rotating an NSView and getting its corner points

I am rotating an NSView using:
setFrameRotation:
Which rotates the view around its bottom left corner. What is the best way to rotate a view around its center point?
Also, i want to get the points in the superview of its corners. Using:
view.frame.origin
Just gives me the corner before i rotate it. How would i get the actual points of its corners once it has been rotated?
Thanks in advance, Ben
To get an effective rotation about the center of the frame, you have to translate the frame's origin.
Also, of course view.frame.origin gives the origin before you rotate it. It's also giving you the origin after you rotate it, because the rotation is around the origin. The origin isn't moving. If you do translate the origin to get rotation around the center, you'll then know the new origin.
To get the other corners, you'd use [view convertPoint:pt toView:view.superview], where pt is each of the corners in the view's coordinate system. E.g. NSMakePoint(NSMaxX([view bounds]), NSMinY([view bounds])).
You can actually use this technique to obtain the translation you want. Compute the desired center of the view, or just record the current center if it's where you want it. Then rotate the view. Obtain the new location of the center using -convertPoint:toView:. Then translate the origin by the difference between the new center and the desired center.

Resources