I am generating rotated, truncated ellipsoids in a three-dimensional grid by assigning index value $i$ to grid nodes at $(x,y,z)$ that meet the following conditions:
$$\frac{((x-X_i)\cos(\alpha_i)+(y-Y_i)\sin(\alpha_i))^2}{a^2} + \frac{((x-X_i)\sin(\alpha_i)+(y-Y_i)\cos(\alpha_i))^2}{b^2} + \frac{(z-Z_i)^2}{c^2} \leq1 \wedge z\leq Z_i $$
with $X_i$, $Y_i$, and $Z_i$ the central coordinates of the ellipsoid, $\alpha_i$ is the angle between the $z$-axis and the major axis of the ellipsoid, and $a$, $b$ and $c$ are the length, depth and width of the ellipsoid respectively.
I would now like to assign dip (angle from horizontal) and strike (angle about the $z$-axis) values to the grid nodes within the truncated ellipsoids, for which I'm guessing I should calculate tangent planes to the ellipsoids. However, the way I assign indices to the grid nodes means that it is likely the node does not lie directly on the ellipsoid curve - this seems to be an important assumption in determining the tangent plane.
Question: How can I calculate the dip and strike values at each grid node, based on the truncated ellipsoids that I have generated? Is determining the tangent plane the right direction to go?
Progress so far: I should find the tangent plane at point $(x_0,y_0,z_0)$ on ellipsoid $$F(x,y,z)=\frac{\chi^2}{a^2}+\frac{\psi^2}{b^2}+\frac{\zeta^2}{c^2}-1$$ by taking the derivative of the ellipsoid function, which considering the first equation, is $$\nabla F = \frac{(2\cdot (x-X_i)\cos(\alpha_i)^2+2\cdot(y-Y_i)\sin(\alpha_i)\cos(\alpha_i)}{a^2} + \frac{(2\cdot (y-Y_i)\cos(\alpha_i)^2+2\cdot(x-X_i)\sin(\alpha_i)\cos(\alpha_i)}{b^2} \\ + \frac{2\cdot(z-Z_i)}{c^2}\cdot$$
If I solve this for the grid nodes that are closest to 1 I think I can then solve for dip and strike by finding the angle between the tangent plane and a horizontal plane. I would then assign these values to grid cells with the same $x$ and $y$ coordinates (this approximation is fine for my application).
How am I going? Is this the right track? Is there a more elegant way of solving this problem? I am a geologist with limited math background, so forgive me if I have left out some important information, or if my working is poor.