Can I use PCA for dimensonality reduction from 3D to 2D and apply curve fiting to get the poly equation? - curve-fitting

I am trying to get my third order poly function from 3D data so can I apply PCA for dimension reduction (from 3D to 2D) and then apply curve fitting to get my 3rd order.
Image of the curve

Related

Having a complex-to-complex 2D FFT, how to do 3D FFT?

Say we have a 2D complex-to-complex FFT implemented. How we can now use it to implement 3D FFT - is it just N slices of 2D?
No, a 3D DFT (FFT is a family of algorithms that efficiently computes the DFT) is not the same as applying 2D DFTs to each slice in a 3D array/image/whatever.
Whether what you need is a 3D DFT, or 2D DFTs applied to each slice depends on what you’re trying to accomplish.
An nD DFT is computed by applying 1D DFTs (FFTs) to each row, then on the result again to each column, etc. until each dimension has been processed. So what you need is a 1D FFT.

3D mesh generation: How to choose up-axis when extruding 2D shape along 3D curve?

I have a 2D shape (a circle) that I want to extrude along a 3D curve to create a 3D tube mesh.
Currently the way I generate cross-sections along the curve (which form the basis of the resulting mesh) is to take every control point along the curve, create a 3D transform matrix for it, then multiply the 2D points of my circle by those curve-point matrices to determine their location in 3D space along the curve.
To create the matrix (from 3 vectors), I use the tangent on the curve as the up vector, world-up ([0,1,0]) as the forward vector, and the cross product of the up/forward vectors as the right vector. All three vectors are also orthogonalized during the process to create the final matrix.
The problem comes when my curve tangent is identical to the world-up axis. Ie, my tangent vector is [0,1,0] and the world-up is [0,1,0]....since the cross product of two parallel vectors is not explicit....the resulting extruded mesh has artifacts along those areas of the curve (pinching, twisting, etc).
I thought a potential solution would be to use the dot product of the curve tangent and the world-up as an interpolation value to shift my forward vector from world-up to world-right...in other words, as a curve tangent approaches [0,1,0], my forward vector approaches [1,0,0]...but that results in unwanted twisting along the final mesh as well.
How can I extrude my shape along a curve in a consistent manner that has no flipping/artifacts/twisting? I know it's possible since various off-the-shelf 3D applications can do it...I'm just not sure how.
One way I would approach this is to consider my tangent vector to the 3D curve as actually being a normal vector of the plane I am interested into.
Let's say, the tangent vector is
All you need now is two other vectors that are othoghonal to it, so let's.
Let's construct v like so:
(rotating the coordinates). Because v is the result of the cross product of u and something else, you know that v is orthogonal to u.
(This method will not work if u have equal x,y,z coordinates, in that case, construct the other vector by adding random numbers to at least two variables, rince&repeat).
Then you can simply construct w like before:
normalize and go.

Rotation matrix of ligand in vmd

I am trying to get rotation matrix of ligand to find Euler angles using VMD software. Using measure inertia command I can get principal axes of rotation. How can I form rotation matrix from normalized principal axes? In one paper I found that some solution related to ordering Eigenvalues of the moment of inertia tensor. Also when I form rotation matrix using principal axes as columns, in some cases I get the matrix with determinant -1 ( it should be 1 for proper rotation matrix). How to deal with such improper rotation matrices to get Euler angles?

fft of perturbations on a circle in MATLAB

I have an image showing a circle (shown) with a mix of different modes of perturbation imposed on it. It is inconvenient to "unwrap" this circle into Cartesian coordinates to perform FFT on account of some other additional features. Is it possible to use FFT on the circle - can I pass FFT an object or a binary matrix with 1s inside the shape, 0s outside to obtain the power spectrum on that surface?

Can I use a 3-dimensional simplex noise implementation to generate noise over a spherical surface?

Say, I want to generate noise over a sphere.
I want to do this to procedurally generate three-dimensional 'blobs'. And use these blobs to generate low poly trees, somewhat like this:
Can I accomplish this as follows?
First define a sphere that consists of a certain number of vertices, each of them defined by known (x,y,z) coordinates
Then generate an additional entropy (or noise) value e as follows:
var e = simplex.noise3d(x,y,z)
then use scalar multiplication to offset, or extrude the original point into 3D space, by entropy value e:
point.position.multiplyScalar(e)
Then finally reconstruct a new mesh from these newly computed offset points.
Can I define a sphere that consists of a certain number of vertices, each of them defined by known (x,y,z) coordinates, and then generate an entropy or noise value
I consider this approach because it is widely used to generate terrain meshes using two-dimensional noise on a two dimensional plane, thus resulting in a three dimensional plane:
Looking at examples I understand this concept of terrain generation using two-dimensional noise as follows:
You define a two-dimensional grid of points, essentially a plane. Thus each point has two known coordinates and is defined in three-dimensional space as ( X, Y = 0, Z ). In this case Y represents the height that will be computed by a noise generator.
You feed the X and Z coordinates of each point in the grid to a Simplex noise generator, that returns noise value Y.
var point.y = simplex.noise2d(x, z);
Now our grid of points has been displaced across the Y axis of our three-dimensional space, and we can create a natural-looking terrain mesh from them.
Can I use the same approach to generate noise on a spherical surface using three-dimensional noise. Is this even a good idea? And is there a simpler way?
I am implementing this in WebGL and Three.js.
If you want something to look like a tree, you should use a tree-growth algorithm to first simulate a tree branching pattern, then poly the outer surface of the tree. Different types of trees have what are called "habits" or chiral patterns that determine how they grow. One paper that describes some basic equations for modeling branch/leaf grown is:
http://www.math.washington.edu/~morrow/mcm/16647.pdf

Resources