How to Combine Vector Directions for Animated Surfaces in OpenGL?

In summary, the conversation discussed the use of vectors in an application written in OpenGL and the desire to animate surfaces by adding two functions, t2center and t2normal. The speaker was unsure which operation to use to combine normals or directions of the surface with these functions. They also mentioned the use of functional composition and the need for a different parametric function to ensure continuity among surfaces.
  • #1
ADDA
67
2
Hi,

I have a question regarding vectors. I am thinking ahead regarding an application that I am writing in OpenGL. Currently, four functions make up the vertex calculations, with one independent variable (w2center, w2normal, w2uv, uv2vector). A per-vertex center variable and per-vertex vector basis, calculated from w2normal, gives additional input uv2vector or the function which outputs the vertex. I would like to be able to animate surfaces rendered by adding two functions t2center and t2normal. Vector translation should be simple for t2center with an addition operation of w2center, yet I am unable to think or remember which operation I would use to combine normals, or directions of the surface, with the two two functions w2normal and t2normal. Would someone suggest an operation?

Below is an example image. The process involves relative centering with a surface hierarchy. Axii are drawn from surface centers, red is x or i, green is y or j, blue is z or k. The sphere has a single point center, yet the second surface has a parabolic line as its center, which is slightly able to be viewed by the black dots below the x or i axis. Taking for normal the first derivative of the parabola, I would like to be able to move center through another function, t2center, which would then change the "normal" or direction of the per-vertex basis. I think that addition is correct for centers, yet which operation would I use to combine the normals?
Screenshot-2017-02-09-12-18-22.png
 
Last edited:
Physics news on Phys.org
  • #2
Adam Bryant Been said:
I have a question regarding vectors. I am thinking ahead regarding an application that I am writing in OpenGL. Currently, four functions make up the vertex calculations, with one independent variable (w2center, w2normal, w2uv, uv2vector). A per-vertex center variable and per-vertex vector basis, calculated from w2normal, gives additional input uv2vector or the function which outputs the vertex. I would like to be able to animate surfaces rendered by adding two functions t2center and t2normal.
Do you mean by writing these two functions or are you actually referring to some addtion operation?
Adam Bryant Been said:
Vector translation should be simple for t2center with an addition operation of w2center
, yet I am unable to think or remember which operation I would use to combine normals, or directions of the surface
What do you mean by "combine normals"?
Adam Bryant Been said:
, with the two two functions w2normal and t2normal. Would someone suggest an operation?

Below is an example image. The process involves relative centering with a surface hierarchy. Axii are drawn from surface centers, red is x or i, green is y or j, blue is z or k. The sphere has a single point center, yet the second surface has a parabolic line as its center, which is slightly able to be viewed by the black dots below the x or i axis. Taking for normal the first derivative of the parabola, I would like to be able to move center through another function, t2center, which would then change the "normal" or direction of the per-vertex basis. I think that addition is correct for centers, yet which operation would I use to combine the normals?
I am not understanding what you're trying to do here.

BTW, the plural of "axis" is "axes," not "axii."
 
  • #3
Thank you for your reply, Mark44. I am planning on using vector translation (addition) for dynamically changing the center point or curves, given a time variable, t.

With my current setup, the normal (or direction or first derivative of the center curve) would not combine with translation, rotation, an inner product or cross product. I'm defining the normal as a direction pointing in the positive x direction, the right as a direction pointing in the positive y direction, and the up as a direction pointing in the positive z direction. These three directions are what I refer to as a basis.

I've been writing various GLSL functions with my current setup, and the center variable is loosely defined and may output a set of points ranging from a
singular point (the sphere), a curve (the second surface), or a plane in 3-space, or a surface in 3-space.

So, thinking backward from uv2vector, to ensure continuity among separate surfaces through animation with a time variable t, I am unsure how to combine normals or directions or a vector field. Instead of using standard cartesian coordinates <1,0,0> as normal <0,1,0> as right <0,0,1> as up, I'm defining a function for normal then forming cross products to produce an orthonormal basis.

I've extended the above example with a few more sceenshots:

surface_example1.png

surface_example2.png


In these the center curve is more clearly seen. The normal would be a vector field of directions corresponding to each derivative. I'm attempting to keep this simple, yet it's getting complex quick. Since the outer surface's vertices are calculated from the point-wise basis, if I were to use a function for the initial shape of the surface, then a separate function to animate it, as creativity may permit, I'm lost as to how I might combine directions.
 
  • #4
Adam Bryant Been said:
yet I am unable to think or remember which operation I would use to combine normals, or directions of the surface, with the two two functions w2normal and t2normal.

Got a bit wordy here. I am referring to the directions of the center curve, seen in the above examples with the parabolic dots.

I'm trying to figure out functional composition applied to a vector field. At least I think that's the proper term. I think, perhaps...

f(w) = w2normal (initial vector field)
g(t) = t2normal (animated vector field)

To ensure continuity among surfaces I would need a different parametric function of w and t instead of separate functions. However, I would like to compose it of f(w) and g(t), so that I may write different g(t) functions for one f(w) function.

h(w,t) = ?
 
  • #5
Mark44, I guess all that I needed was the sum rule of derivatives... the gifs are not animating?
frame_00000000.png
frame_00000015.png
frame_00000030.png
frame_00000045.png
frame_00000060.png
frame_00000075.png
frame_00000090.png
 

Attachments

  • frame_00000006.png
    frame_00000006.png
    18.3 KB · Views: 359
  • frame_00000000.png
    frame_00000000.png
    18 KB · Views: 384
  • frame_00000029.png
    frame_00000029.png
    18.8 KB · Views: 357
  • #6
There is a solution to surface continuity:

 
  • #7
End Result:

 

1. What is a vector direction?

A vector direction is a quantity that has both magnitude and direction. It is represented by an arrow pointing in the direction of the vector, with the length of the arrow representing the magnitude.

2. How do you determine the direction of a vector?

The direction of a vector can be determined by finding the angle between the vector and a reference axis. This can be done using trigonometric functions such as sine, cosine, and tangent.

3. What is the difference between a scalar and a vector?

A scalar is a quantity that has only magnitude, while a vector has both magnitude and direction. Examples of scalar quantities include temperature and mass, while examples of vector quantities include velocity and displacement.

4. How are vector directions applied in real-world scenarios?

Vector directions have many real-world applications, such as in navigation, engineering, and physics. They are used to describe the direction and magnitude of forces, velocities, and displacements.

5. What are some common mathematical operations involving vector directions?

Some common mathematical operations involving vector directions include addition, subtraction, and multiplication by a scalar. These operations allow for the manipulation of vector quantities and can be used to solve problems in various fields.

Similar threads

Replies
1
Views
1K
Replies
7
Views
1K
  • Introductory Physics Homework Help
Replies
24
Views
1K
Replies
9
Views
1K
Replies
3
Views
11K
  • Calculus and Beyond Homework Help
Replies
4
Views
2K
  • Calculus
Replies
1
Views
2K
  • Introductory Physics Homework Help
Replies
11
Views
1K
  • Special and General Relativity
Replies
14
Views
2K
  • Differential Geometry
Replies
6
Views
2K
Back
Top