measuring intersection angle between circle and line with thickness - vb.net

In the attached drawing, it is required to find the angle 71 resulting from the intersection of the arc with the line from the outside and the arc with the line from the inside, noting that the thickness is 5 cm. The problem is that I do not know the location of the intersection of the internal arc with the internal line to form a vertical angle 71. The intersection point is required by mathematical equations or by visual basic
Finding the point of intersection of the interior arc with the interior vertical line and the angle measure 71 by mathematical equations or by visual basic

Related

Conversion of quaternion to Euler angles for pitch crossing 90 degrees

I am using 9-axis IMU fused orientation data and I need to convert quaternion pose to Euler angles for purposes of graphing the data to user. I want my all three angles to be from range [-180, 180] and I found a lot of references how to do that easily.
Roll and yaw work well but when the pitch crosses +90 degrees it starts going back towards -90 and then back to 0, as I increase Y component of my quaternion. This video explains it better.
You can also see the raw data from the sensor on this image:
There are in total three full rotations around each of the axes one after another. First two (solid red and green lines) are OK. Blue one (misslabelled "roll" on the plot, but is actually pitch rotation) does well until it reaches -90 degrees and then flips the direction until +90 and goes back to 0. At the same time this happens, both of the other axes give wrong readings (very fast change).
Is there a way of circumventing this issue around +-90 degrees and computing absolute pose in world frame?

get features under a line mapbox gl js

I need to be able to draw an arbitrarily drawn line in mapbox gl js. The line will be used to select certain points in a vector tile layer underneath the line layer. How does one do this with mapbox gl js. Will I need a custom drawn polygon so I can have full control of the points? I was thinking of using project and unproject as well as the starting point, the pixel width of the line, and the slope of the line, along with some geometry, to iterate through all visible points and get those which are underneath the line. But is there an easier way with the gl js api? QueryRenderedFeatures takes a bounding box, but this seems to be rectangular in nature as well as oriented on a north to south line. I need to be able to draw the line at any angles on the map.
You can create a custom polygon of the area surrounding your line using the turf-buffer function, and you can access the data in the vector tiles within that polygon by using queryRenderedFeatures with a bounding box that encompasses your buffered line polygon and filtering those results using turf-within to get just points that fall beneath your line.

Creating seamless worldmaps with Fractal Brownian Motion

I'm creating heightmaps using Fractal Brownian Motion. I'm then coloring it based on the heights and mapping it to a sphere. My problem is that the heightmap doesn't wrap seamlessly. I've used the Diamond Square algorithm and it's pretty easy to make things seamless using it, but I can't seem to figure out how to do it with fBm and I seem to be having trouble finding an explanation for it on the web.
To clarify, by "seamless", I mean that when I map it to a sphere, it creates a seamless map on the sphere.
Instead of calculating the heightmap per pixel on the heightmap, calculate the heightmap in 3D space based on each point on the sphere and then map that to an image pixel. You're going to have trouble wrapping a 2D, rectangular heightmap like that onto a sphere without getting ugly results at the poles unless you start your calculations from the sphere.
fBM generalizes to 3 dimensions, so given a point on the sphere you can get the height at that point, and then you can do the math to map that value to where it should be stored in the heightmap image.
Or you could use one of the traditional map projections. A cylindrical projection (x, y)->(x, sin y) would give you a seam of just one meridian, which you could rotate to the back. Or you could "antialias" the edge by one or another means.
With a stereographic projection (x,y,z)->(x/(z+1),y/(z+1)), there's only one sour point (the projection point itself).

World space to screen space (perspective projection)

I'm using a 3d engine and need to translate between 3d world space and 2d screen space using perspective projection, so I can place 2d text labels on items in 3d space.
I've seen a few posts of various answers to this problem but they seem to use components I don't have.
I have a Camera object, and can only set it's current position and lookat position, it cannot roll. The camera is moving along a path and certain target object may appear in it's view then disappear.
I have only the following values
lookat position
position
vertical FOV
Z far
Z near
and obviously the position of the target object.
Can anyone please give me an algorithm that will do this using just these components?
Many thanks.
all graphics engines use matrices to transform between different coordinats systems. Indeed OpenGL and DirectX uses them, because they are the standard way.
Cameras usually construct the matrices using the parameters you have:
view matrix (transform the world to position in a way you look at it from the camera position), it uses lookat position and camera position (also the up vector which usually is 0,1,0)
projection matrix (transforms from 3D coordinates to 2D Coordinates), it uses the fov, near, far and aspect.
You could find information of how to construct the matrices in internet searching for the opengl functions that create them:
gluLookat creates a viewmatrix
gluPerspective: creates the projection matrix
But I cant imagine an engine that doesnt allow you to get these matrices, because I can ensure you they are somewhere, the engine is using it.
Once you have those matrices, you multiply them, to get the viewprojeciton matrix. This matrix transform from World coordinates to Screen Coordinates. So just multiply the matrix with the position you want to know (in vector 4 format, being the 4ยบ component 1.0).
But wait, the result will be in homogeneous coordinates, you need to divide X,Y,Z of the resulting vector by W, and then you have the position in Normalized screen coordinates (0 means the center, 1 means right, -1 means left, etc).
From here it is easy to transform multiplying by width and height.
I have some slides explaining all this here: https://docs.google.com/presentation/d/13crrSCPonJcxAjGaS5HJOat3MpE0lmEtqxeVr4tVLDs/present?slide=id.i0
Good luck :)
P.S: when you work with 3D it is really important to understand the three matrices (model, view and projection), otherwise you will stumble every time.
so I can place 2d text labels on items
in 3d space
Have you looked up "billboard" techniques? Sometimes just knowing the right term to search under is all you need. This refers to polygons (typically rectangles) that always face the camera, regardless of camera position or orientation.

design a circle in the 3-D space

How to design a circle in the 3-D space?
For a circle in the 2-D space, two members are enough.
1 center;
2 radius;
but in 3D, how can I define the direction and the position of the circle?
One possibility would be to include a vector that's normal to the plane on which the circle lies. This has the advantage that if you ever decide to render the circle, the normal will be used to determine things like reflections off the surface defined by that circle.
Do you really want a Circle (a 2D Shape) in a 3D Space? Then this could be solution:
x,y,z: Coordinates of the center of the circle
dx,dy,dz: Direction of the plane the circle is located in
r: radius
Depending on what you want to do with the object - I have another alternative.
Model the circle as a unit circle in the xy plane with z=0.
with scaling, translating, and rotating operations done to it.
If you plan on doing many matrix operations on your objects, this may be the way to go.
You could also keep the unit circle's position, radius, and normal to plane information as properties. and have a method to convert between the two describing methods .
Circle() - Default Unit circle at (0,0,0), radius 1, xy plane at z=0
Circle(scale, translate, rotate) - my constructor
Circle(location, radius, normal) - the other proposed constructor