# drawing an arrow in add SOP?

I have an add SOP which creates two points and connects them to a line. The two points are at changing xyz positions and are not aligned to a specific axis.

Now in the add sop, I wanna also create points which form an “arrow head” at the end of the line, and then connect them to form an arrow pointing in the “direction” of the line

Any ideas?
Thx
A

is this a 3d or 3d arrow?

in any case you obviously can get the tip of the arrow by figuring out the slope between your line’s start and end points (a subtraction) then normalizing that if you want to have a standard size (as opposed to a ratio of the length of the line) and adding it to your end point.

if it’s a 2D arrow you can get the sides of the arrow by rotating the tip around the end point (z rot, with the end point as a pivot) then scaling it to the right width (you do this for left and right sides).

if it’s a 3D arrow, and it’s not a cone but something flatter/asymmetric, you’ll need to know where your up vector is (ie. to determine the arrow rotation along the endpoint-tip axis).

dani

thx dani. It’s a 2d arrow. Can all this be done in a single add SOP? I’ve no idea how to rotate or scale a point directly in the add SOP.

I don’t time to figure out how to do it with only one add sop.

here’s one component which does it with two add (one for the line and one for the arrow) and a transform.

for clarity there’s a text DAT which sets the variables to line start/end and arrow dimensions, and I’m assuming you’ll get those values from somewhere else and can plug them directly into the adds and transform instead of using the variables.

let me know if it helps.
tx
d
base1.tox (1.05 KB)

thx for the example dani. Unfortunately I don’t know how to make this to work in a single add SOP. Guess it’s possible with some of the matrix expressions, but have no idea how. anyone else got some input?