How to get coordinates in Petrel 2d Mapwindow through mouse click event? - ocean

How to get coordinates dynamically in Petrel 2d Mapwindow through mouse click event?

If you implement a custom WindowMode, you can access the coordinates via the PickedPoint API. The "World" property will give you the X-Y coordinates in world space, and the Z is determined by the domain object (if any) under the mouse cursor.
There is also a separate window-based coordinate system that uses fixed spacing X and Y coordinates based on the Map viewport.

Related

(How) can a matplotlib figure be made to respond to "zoom" navigation in one dimension only?

Matlab has a useful zoom mode triggered by zoom xon or zoom yon whereby you can click-and-drag with the mouse to zoom in on data, but with only one dimension (x or y, respectively) changing. Instead of an elastic box, the cursor changed into an elastic I-beam that allowed you to set the beginning and end of the range quite precisely.
Is there any way of getting a matplotlib figure to do the same thing? Playing with the toolbar, and briefly looking into the code behind it, I only see a "zoom rect" mode.
I'm aware that you can approximate this effect by right-clicking-and-dragging in "pan" mode, while trying to ensure that your hand only moves in one dimension, but that can be quite frustratingly imprecise. If there were a zoom xon equivalent, I would gladly use that instead.
The interactive navigation lists among its shortcuts
Constrain pan/zoom to x axis: hold x when panning/zooming with mouse
Constrain pan/zoom to y axis: hold y when panning/zooming with mouse

Blender 2.8: object pivot + pixel align + object part grouping (newbie)

I have started learning Blender 2.8 as of May-25. Almost 10 years ago, I was using 3dmax v7 but only as a hobby. I want to start doing 3ding again as hobby but got no money to have something that is up to date. So I chose Blender.
Now I have a few questions. I will surely have more questions later. I am still thinking in terms of 3dmax ways.
How do I recenter the object pivot if I accidentally displaced it with MB1 and doing Ctrl-Z is not a solution ?
How do I align vertices to the grid but only using the axis of my choice ? (ex: align on the X axis grid or any other axis of my choice)
how do I group object parts (vertices, faces, ...) as different groups and then working with the group of my choice ?
how can I maximize the view port with one single keys shortcut thus hiding every menus and then once I am done doing what I wanted to on that maxed view, revert back to whatever interface view I was using before ?
how to select anything using a region drawn by mouse movements (meaning selecting without using box or circle or shift, just mouse mouvements)?
Firstly blender 2.80 is under heavy development while making some major changes so can be of varying functionality for now. I would suggest you start learning with 2.79b until 2.80 is finished.
There are several options when it comes to choosing a pivot point, I think what you are referring to is setting the object origin.
There are several snapping options and ways to control transformations. You can limit movement to one axis by pressing it's key while transforming, eg GX will only move along the X axis, you can not move on one axis by adding ⇧ Shift - G⇧ ShiftX will move on Y and Z but not X. To align vertices to one axis is it common to scale to zero one the axis, eg SX0 will scale the verts on the x axis so they all align, in object mode you can do the same as long as you enable manipulate centre points. There are align options available in some addons, like align tools and mesh align plus.
Blender doesn't have vertex grouping and I don't know of any addons that add it. You can assign vertices to a vertex group and use that to select/deselect a collection of vertices.
There are two options to maximise the viewport - ⎈ Ctrl↑ Up arrow will maximize the viewport, the info bar at the top and headers for the view will remain in place or ⎇ AltF10 will make the view full screen also removing the info bar and headers. Also the window layouts are saved as screens which you can make and define to your liking, by saving these screens in your startup blend you can keep them available each time you use blender. The default screens include a 3D only layout.
For lasso select you can hold ⎈ Ctrl while pressing the non-select mouse button to draw an arbitrary region to select items within.

Where does the coordinate system for windows forms stop and start?

I am using VB.NET to write a game that runs in a windows form that uses collision detection. In order to achieve this, I have to be able to understand the positioning system. I know that windows form coordinates start at the top-left, and don't include the bottom or right edges. But at what numbers do the coordinates start and stop? (What i mean is What is the top left corner coordinate, what is the almost bottom right corner coordinate)
The coordinate system depends on if you're talking about client coordinates or screen coordinates. This is a basic Windows UI manager thing, and the WinForms wrappers follow the same pattern.
When you're dealing with client coordinates, the origin (top-left) point has coordinates (0, 0). Always. The extent is defined by the width and height of your form, accessible via Me.ClientSize.Width and Me.ClientSize.Height, respectively. The client rectangle is, therefore:
{ (0, 0) × (ClientSize.Width, ClientSize.Height) }, also retrievable using the ClientRectangle property.
The unique thing about the client area is that it excludes the non-client areas of the form—the borders, the title bars, and other system-dependent properties.
(Image taken for illustrative purposes from Jose Menendez Póo's article on creating an Aero ToolStrip)
You don't have to worry about calculating these sizes (and you shouldn't, either, since they're subject to change). You just work in client coordinates, and the framework will take care of the rest. You use client coordinates when positioning child objects (such as controls) on their parent form, and you can even resize the form by specifying a client size. Its actual size will be calculated automatically, taking into account the non-client area.
It is quite rare that you will ever have to deal in screen coordinates. You only need those if you want to move a form (window) around on the screen (which should also be rare, because you have no idea what size screen the user has nor should you try to control where she places her windows). In screen coordinates, the top-left corner of the primary monitor has coordinates (0, 0). The rest of the coordinate system is based on the virtual screen, which takes into account multiple-monitor configurations.
A form's Location and Size properties give you values in screen coordinates. Should you need to map (convert) between client and screen coordinates, there are PointToClient and PointToScreen methods. Pass these a location defined either in terms of screen or client coordinates, respectively, and they will convert it to the other coordinate system.
The only other complication to note is that Windows uses endpoint-exclusive rectangles. The WinForms wrapper retains that convention in its Rectangle structure. You hardly ever have to worry about this, since this is really a very natural system once you understand it. Plus, all of the pieces and parts of the WinForms framework use the convention, so if you're just passing around points and sizes and rectangles, you aren't likely to run into trouble. But it is something to be aware of. Think of it this way: your client area has the rectangle { (0, 0) × (ClientSize.Width, ClientSize.Height) }, as we saw earlier. If you were to fill in this rectangle with a solid color, the fill would extend from point (0, 0) to point (ClientSize.Width - 1, ClientSize.Height - 1).
If you stay within your form, you can calculate it by "width" and "height".
Also you have "left" and "top".
Starting is (left = 0 and top = 0) and it ends on the right bottom with the coordinates of the values "width" and "height".
A Windows Forms application specifies the position of a window on the screen in screen coordinates. For screen coordinates, the origin is the upper-left corner of the screen. The full position of a window is often described by a Rectangle structure containing the screen coordinates of two points that define the upper-left and lower-right corners of the window. (MSDN)
So upper left corner is (0, 0) and lower right corner is (Form1.Width, Form1.Height).

Simulating a map with DataVsualization.Chart

VB2010 I am using the DataVisualization.Charting.Chart control and am using it as a very crude map of several geographic points. I have that working and it looks good but am trying to see about adding an image to the chart so that it would simulate the land masses. The problem I see is that I zoom around the chart programmatically, so not sure how i can anchor the image to certain x,y coordinates. I don't want to go the whole GIS component as those types of controls are just too much for this fairly simple app.
Update: Well I sort of resolved it. I generated a full world map based on the WGS84 (some would call geographic) projection. This splits the world into perfect 20d x 20d squares. I added this graphic to the BackImage property of my main Chart. I add my points but force the extents of the graph to x: -180 to 180 and y: -90 to 90. Its crude but its actually spot on for my purposes. The only thing that i cant do is zoom in to my points of interest as the background image is static. I wish there was a way to zoom the background image to anchor parts of the image to coordinates on the graph.

How to adjust the Camera position so that objects can be viewed in enough size with three.js?

I've made an application where it takes values from external file to create geometry. I'm very much successful in that. By default, my objects are viewing in very smaller in size. But when I tried with mouse ball rolling I can see the actual objects in the scene as it zooms into the scene. But, how could I obtain this size of objects as my scene is instantiated.
The link to working application : http://studenter.miun.se/~sagh0900/TrackBallAlt.Html
Here is the zoomed version view of scene and its objects
You can use either of these to get the size of the bounding box or sphere of your mesh.
// This computes it.
mesh.geometry.computeBoundingSphere();
// This gets it
var radius = mesh.geometry.boundingSphere.radius;
// Compute the bounding box
mesh.geometry.computeBoundingBox();
// This now has a min and max structure with x and y values of the box
mesh.geometry.boundingBox
Once you have that information you can set your camera so the objects are in view.