# Reverse Node for Vector to angle?

## Recommended Posts

Hi,

I have to move some objects in an angle but i only got vectors, so i dont know how to calculate a vector out of an angle and there is only "vector to angle" node.

MAybe someone has a reverse node or knows how this goes better with different nodes.

I have a list of path extruded rectangles along lines, which generated out of a polyline (red).

But the profile which is extruded allways is "placed" in the middle (center of bounding box) of my path extrude.

But I need this extrudes BEHIND or INFRONT the line (The Profil has to be extruded in the edge of my ).

So i thought i can read out a list of angles of the lines and use the "MOVE" node to move the Boxes half height and half width.

But the node needs a vector not an angle.

BR KC

Edited by KingChaos

yeah offset the single lines half the objects width makes it.

but it would be great to have some "vector to angle" node.

Hello,

there is a VS Function that converts an angle into a vector. You can look it up here.

With that Function you can write your own Marionette Node. In Python it could look something like this:

```
@Marionette.NodeDefinition
class Params(metaclass = Marionette.OrderedClass):
#APPEARANCE
#Name
this = Marionette.Node( 'Angle to Vector' )
this.SetDescription( 'Converts an angle in degrees to a 2D vector' )

#Input Ports
nAngle = Marionette.PortIn(0)
nAngle.SetDescription( 'an angle in degrees' )

nLength = Marionette.PortIn(1)
nLength.SetDescription( 'the length of the output vector' )

#OIP Controls

#Output Ports
v = Marionette.PortOut()
v.SetDescription( 'a 2D vector' )

#BEHAVIOR

def RunNode(self):
#inputs
nAngle = self.Params.nAngle.value
nLength = self.Params.nLength.value

#script
v = vs.Ang2Vec(nAngle, nLength)

#outputs
self.Params.v.value = v```

But, as shown in the example below, in some cases the VS function returns realy small numbers instead of zeros. So i would recommend to round the returned values to a reasonable length.

Edited by Letti R

Rounding mistake ist Think

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×

• KBASE
• #### MARIONETTE

×
• Create New...