regie
February 8, 2024, 10:41pm
1
Hi

For a plugin I’m working on, I need to align component along an edge using the red axes component.

Here I’am, I have the edge as a vector

```
edge_vector = edge.end.position - edge.start.position
```

I’Am able to get axes projections

```
projection_on_red_axis = edge_vector.dot(X_AXIS)
projection_on_green_axis = edge_vector.dot(Y_AXIS)
projection_on_blue_axis = edge_vector.dot(Z_AXIS)
```

But I’m not able to math it to the right angle an align component would have.

I already tried many many method to do it but no one match.

I do want to understand it cause it is the second time I have to deal with euler angle and it’s a pain for me.

If someone can help

Thank’s a lot

If you had searched the Ruby API subcategory on “euler”, you would have found this:

```
```
# Calculate extrinsic, chained XYZ rotation angles for transformation.
#
# Scaling, shearing and translation are all ignored.
#
# Note that rotations are not communicative, meaning the order they are
# applied in matters.
#
# @param transformation [Geom::Transformation]
#
# @example
# # Compose and Decompose Euler Angle Based Transformation
# x_angle = -14.degrees
# y_angle = 7.degrees
# z_angle = 45.degrees
# transformation = Geom::Transformation.rotation(ORIGIN, Z_AXIS, z_angle) *
# Geom::Transformation.rotation(ORIGIN, Y_AXIS, y_angle) *
# Geom::Transformation.rotation(ORIGIN, X_AXIS, x_angle)
# angles = SkippyLib::LGeom::LTransformation.euler_angles(transformation)
# angles.map(&:radians)
#

This file has been truncated. show original

regie
February 9, 2024, 12:29am
3
Thank’s Dan

In fact it’s been few days I’m searching, I found many people talking about it and
I already found this but it’s not so clear for me and I don’t know how to use it.

I read the exemple but I’m still note able to mange it.

But thanks to you I’m back on the track.