0

First of all, sorry for the question.

I really didn't want to ask this kind of "bad" question since it must be something "obvious" I'm missing. But I have been trying to fix this for more than a day.

How the Box is described:

The box is described by 3x3 quantities: Starting position, Length, Rotation Angle and that's one quantity for each of the cartesian axes (x,y,z). Here is a Picture of how the Box is described (its through an Animation Tool).

What I want to express:

Basically I want to "trap" the space between that box. For Example if the box was simply parallel to the Axis I would just say $$ x_m ≤x≤ x_M $$ same thing for $y,z$

Now this is a harder case but that's what I want to achieve. $$ f(y,z) ≤x≤g(y,z) $$ as TomKern said.

What I have tried:

I have tried to rotate the three vectors defining the Box around original axis starting from x to z. (The order matters I think). Read about Eulerian Angles but still going to center of the box and rotating it with the same order didn't have much success from what I saw.

Maybe a silly idea: Trying to find "3" parallel surface that passes from the starting point, each one respecting the "other two" angles might work. For that I just need a way to express the normal of each of the 3 surfaces.

Sorry for the question

Jean Marie
  • 88,997
  • Are you looking for the maximum and minimum possible values of $x, y,$ and $z$ for the box, or are you looking for inequalities that define the $x$ coordinates of the box precisely? something like $f(y,z) \leq x \leq g(y,z)$? – TomKern Apr 09 '21 at 19:59
  • Do you want $(x,y,z)\to(u,v,w)$ after the rotation and then $u_m<u<u_M$, same for the other two coordinates or still express the inequalities for $x,y,z$ variables ? Anyway I guess, it is better to set the origin point at the center of the box. I think it is easier to work in the rotated coordinates though since it is the same as the case with faces // to the axis. – zwim Apr 09 '21 at 20:16
  • @zwim Thing is that the Paraview Tool just "generates" the box this way. You can just add the half_length and go to the center from the starting position though. What you say works. I mean If I get to an expression $ u_m < u < u_M $ I can essentially turn it to x,y,z variables (which is what I want -> $$f(y,z)≤x≤g(y,z) $$) – user174411 Apr 09 '21 at 20:43
  • @TomKern EXACTLY this. Let me also edit it in the question. So far I haven't succeed to make any progress, especially since i noticed that the rotations on the paraview tool, don't acutally have an "input" order. And can't really figure it out (thought it had something to do with Eulerian Angles but yeah. Nothing to help me solve it) – user174411 Apr 09 '21 at 20:46

2 Answers2

1

Take two opposite faces of the cube and let's work out the inequality defining what it means to be between those two faces (where the faces have been extended infinitely in all directions).

To make the explanation neat, let's assume the center of the cube is at the origin and the side length of the cube is length 2.

First, work out the normal vector to the faces $\vec{n}$. The dot product $\vec{v} \cdot \vec{n}$ measures the length of the projection of $\vec{v}$ in the direction $\vec{n}$. Being between these faces means the length of that projection is between -1 and 1.

In other words, if $\vec{n} = (a,b,c)$ and $\vec{v} = (x,y,z)$, $$-1 \leq ax+by+cz \leq 1.$$ You can then solve this inequality for $x$ (separate out the cases $x < 0, x = 0,$ and $x > 0$), to get the inequalities on $x$ you're looking for.

Do this for all three pairs of opposite faces and you'll have three inequalities on $x$ (and then $x$ is larger than the maximum of the lower bounds and smaller than the minimum of the upper bounds)

TomKern
  • 3,407
  • Really thank you for the reply. To get it clear, the lenght is added to the equation with the $\vec{n}$ that is the vector that connects the two faces right? (if so the equation should be $0<\vec{n} \cdot \vec{u} <1$ no? )

    Also I'm having trouble considering the "angles" that are presented in the box representation. Each side only cares about two angles right? Isnt the order of rotation important? Or nah?

    – user174411 Apr 10 '21 at 14:40
  • If the origin is the corner, it's $0 < \vec{n} \cdot \vec{u} < 1$. If the origin is the center of the cube, it's between -1 and 1. The order of the rotations matters. Each rotation is a rotation matrix. Apply the rotation matrices to the original normal vectors (1,0,0), (0,1,0), and (0,0,1) in the order you apply them. – TomKern Apr 10 '21 at 16:15
  • that's the thing. On the link/screenshot I uploaded. There is no apparent order. You just set "orientation angles". If the orientation angles are the same, the box is the same (therefore is not dependent on the order I set the angles) – user174411 Apr 10 '21 at 18:21
1

The box interior can be specified by 6 inequalities, each associated with one plane. For each plane, it is specified by one function (say $f_1(x_1,x_2,x_3) = a_1x_1+a_2x_2+a_3x_3-b = 0$).

Let $R_{v,\theta}$ represent the orthogonal rotation matrix which rotate a point along axis $v=(v_1, v_2, v_3)$ with angle $\theta$. Suppose the rotation matrix map $x$ to $x'$, where $x'=R_{v,\theta}x$. The plane before rotation is $$ \{x: f_1(x) = 0 \}$$

The plane after rotation is

$$ \{x': f_1(R_{v,\theta}^{-1}(x')) = 0\} $$

Therefore, after rotation, the plane is specified by the composite function $f_1 \circ R_{v,\theta}^{-1}$. They are polynomials functions with three spatial variables and degree 1.

Back to the original question. The rotated box interior is specified by 6 inequalities, each looks like $f_1 \circ R_{v,\theta}^{-1} (x) > 0 $.

WHLin
  • 234