Transform 3D Points to 2D with a specific camera position - r

I have a matrix that contains the points of the form (x,y,z). My goal now is to transform these points so that they lie in the 2D plane. I want to keep the angle as shown in the figures. Im working with R and want to use ggplot2 instead of the plotly package.
Can anyone help me with this?

Related

PointCloud to image fed to UNet: How to map predicted image back to 3D PointCloud?

I have a .las file and I performed the following operations:
Convert PointCloud to RGB Image
Convert PointCloud to GroundTruth Matrix.
Crop Images and corresponding GroundTruth Matrix to fixed size 256x256
Train UNet (image and groundtuth label)
Inference. Get prediction Matrix with each pixel representing Labels
So I've a predicted matrix,
I don't know how to map it to PointCloud to see how 3D predicted classification looks like?
I'm using Julia
Unfortunately for your goal, you pre-processed your 3D data by converting it to 2D and then cropping the 2D image further. You can plot the 2D data with colors for differently labeled points to show the 2D results, but you are unlikely to be able to get back to a true 3D plot you can move a point of view through with a 3D viewer that way. You should, if you can, modify your preprocessing so as to train your network on the 3D data directly.
I;ve used binning which was used to project 3D to 2D again from 2D to 3D.

Rendering combined 2D and 3D maps in R

I saw this figure in Leland Wilkinson's book the Grammar of Graphics and was wondering how I could go about creating something similar in R.
I am suspicious this could be done using rgl, persp3d, but there's a couple aspects that are unclear to me like how to create the conformal mapping shown in the coordinates of the XY plane, as well as how to create the 2D color map in a 3D context.
Any advice would be much appreciated. Thanks!
That should be possible with rgl, but there might be some snags in the details. Here's the outline:
The green surface does not appear to have a rectangular base,
so you'll pass matrices for all of x, y and z coordinates to surface3d() to draw it.
I can't tell if the map is on a flat surface with curved edges, or if it's a curved surface. In either case, you plot the surface with a 2D texture showing the map and the contours.
a. To produce that 2D texture, use whatever mapping software you've got, and output the image to a PNG file.
b. To put it on the surface, use surface3d() with arguments texture = <filename>, texture_s = ..., texture_t = ...) where texture_s and texture_t are set to coordinates in the image (bottom left = (0,0), top right = (1,1)) corresponding to each x and y location. The z value is
either constant or varying depending on whether you want it flat
or curved.
The axes will be drawn with axis3d.

Projection of points on plane and the inverse transformation

i'm working on a project where i have a cloud of points in space as input data, my goal is to create a surface.
I started by computing a regression plan for the cloud, then i projected my points on the plane using dot products :
My plane is represented by a point and a normal , i construct the axis of the plane's space using cross products then project each point on these axis.
then i triangulate in 2D (that's the point of the whole operation).
My problem is that my points now are in the plane space and i want to get them back to their inital position (inverse the transformation) to have my surface ON my points.
thank you :)
the best way is to keep the original positions and make the triangulation give you the indices rather than the positions , i hope it will help !

Using point coordinates and diameter to calculate areal projection of points

I have data on a number of ecological variables associated with spatial points. Each point has x & y coordinates relative to the bounding box, however the points represent circular areas of varying diameter. What I'm trying to achieve is to project the area occupied by each point onto the observation window so that we can subsequently pixellate the area and retrieve the extent of overlap of the area of each point with each pixel (grid cell). In the past I have been able to achieve this with transect data by converting to a psp line object and then using the pixellate function in the spatstat package but am unsure how to proceed with these circular areas. It feels like I should be using polygon classes but again I am unsure how to define them. Any suggestion would be greatly appreciated.
In the spatstat package, the function discs will take locations (x,y) and radii r (or diameters, areas etc) and generate either polygonal or pixel-mask representations of the circles, and return them either as separate objects or as a single combined object.

GNUPLOT, How can i know the coordinate (x,y,z)

I'm new for the Gnuplot.
I have some trouble.
For the 2D graph, There is the coordinate (x,y) at the left-bottom but i want to know.
How can i know the coordinate (x,y,z) when i move the mouse pointer on the 3D graph.
I waste my time for search the answer but I'm still cannot find.
thank in advance for your help.
That is not possible, because gnuplot doesn't hold all data points to be accessed by the mouse.
In 2D, the displayed coordinates are extracted from the graph boundaries, but there is no such things to snap the mouse pointer to the nearest plotted data point (like requested in How can I make gnuplot show coordinates of a plotted function which have same x value as the mouse pointer?).
Because of the missing "data snapping", it is not possible to extract the 3D coordinates from the 2D mouse position.

Resources