## Controlling triangle points to be equilateral

• Author
• Message

Goblynn93

• Posts: 29
• Joined: Sun Sep 23, 2018 2:13 pm
• Real Name: Brian Lynn
My trig is horrible... I am trying to create a Triangle that is Equilateral where I can move one point and the other two points will adjust accordingly. I want to use the point coordinates to control other things.

I tried to use a Triangle and a Transform but that doesn't seem to change the points on the triangle. That would have been way too easy!

I've been looking at formulas to build this as an expression but I am not really sure what the best method is or what will work with the way Fusion handles things.

I'm not looking for someone to figure this out for me, but maybe a nudge in the right direction? So many ways to do things to get the same results, maybe someone has an idea better than mine...

Thanks!!

Frank Feijen

• Posts: 70
• Joined: Tue Dec 13, 2016 10:04 am
• Location: Vilvoorde, Belgium
If you have the studio-version, you might be able to do this with FUIcircles?
Code: Select all
`{   Tools = ordered() {      FUICircles1 = Fuse.FUI_Circles {         CtrlWZoom = false,         Inputs = {            Circle_shape_1 = Input { Value = 1, },            Sides_1 = Input { Value = 3, },            Size_1 = Input { Value = 0.1539, },            Circle_shape_2 = Input { Value = 1, },            show_shape_2 = Input { Value = 0, },            Circle_shape_3 = Input { Value = 1, },            show_shape_3 = Input { Value = 0, },            Circle_shape_4 = Input { Value = 1, },            show_shape_4 = Input { Value = 0, },            Circle_shape_5 = Input { Value = 1, },            show_shape_5 = Input { Value = 0, },            Circle_shape_6 = Input { Value = 1, },            show_shape_6 = Input { Value = 0, },            Font = Input { Value = "Arial", },            Style = Input { Value = "Regular", },            Input = Input {               SourceOp = "Background1",               Source = "Output",            },         },         ViewInfo = OperatorInfo { Pos = { 220, 16.5 } },         Version = 100      },      Background1 = Background {         Inputs = {            Width = Input { Value = 1920, },            Height = Input { Value = 1080, },            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },         },         ViewInfo = OperatorInfo { Pos = { 220, 148.5 } },      }   }}`

Frank Feijen

• Posts: 70
• Joined: Tue Dec 13, 2016 10:04 am
• Location: Vilvoorde, Belgium
Or if you prefer to do it mathematically, with a polygon node (adjust lengthsides-value on the controls-tab):
Code: Select all
`{   Tools = ordered() {      Polygon1 = PolylineMask {         DrawMode = "InsertAndModify",         DrawMode2 = "InsertAndModify",         CtrlWZoom = false,         Inputs = {            MaskWidth = Input { Value = 1920, },            MaskHeight = Input { Value = 1080, },            PixelAspect = Input { Value = { 1, 1 }, },            ClippingMode = Input { Value = FuID { "None" }, },            Polyline = Input {               SourceOp = "Polygon1Polyline",               Source = "Value",            },            Polyline2 = Input {               Value = Polyline {               },               Disabled = true,            },            lengthsides = Input { Value = 0.641, },            Point0 = Input {               Value = { 0.1795, 0 },               Expression = "Point(.5-(lengthsides/2), 0.0)",            },            Point1 = Input {               Value = { 0.5, 0.785061462562008 },               Expression = "Point(0.5, lengthsides*math.sqrt(1.5))",            },            Point2 = Input {               Value = { 0.8205, 0 },               Expression = "Point(.5+(lengthsides/2), 0.0)",            },         },         ViewInfo = OperatorInfo { Pos = { 660, 148.5 } },         UserControls = ordered() {            lengthsides = {               LINKS_Name = "lengthsides",               LINKID_DataType = "Number",               INPID_InputControl = "SliderControl",               INP_Default = 0.5,               INP_Integer = false,               ICS_ControlPage = "Controls"            }         }      },      Polygon1Polyline = BezierSpline {         SplineColor = { Red = 173, Green = 255, Blue = 47 },         NameSet = true,         KeyFrames = {            [0] = { 0, Flags = { Linear = true, LockedY = true }, Value = Polyline {                  Closed = true,                  Points = {                     { Linear = true, X = -0.3205, Y = -0.5, LX = 0.213666666666667, LY = 0, RX = 0.106833333333333, RY = 0.261687154187336, PublishID = "Point0" },                     { Linear = true, X = 0, Y = 0.285061462562008, LX = -0.106833333333333, LY = -0.261687154187336, RX = 0.106833333333333, RY = -0.261687154187336, PublishID = "Point1" },                     { Linear = true, X = 0.3205, Y = -0.5, LX = -0.106833333333333, LY = 0.261687154187336, RX = -0.213666666666667, RY = 0, PublishID = "Point2" }                  }               } }         }      }   }}`

Goblynn93

• Posts: 29
• Joined: Sun Sep 23, 2018 2:13 pm
• Real Name: Brian Lynn
Frank Feijen wrote:If you have the studio-version, you might be able to do this with FUIcircles

I do have Studio. I'm new to Fusion but long time AE user and Fusion's capacity to render ProRes on PC was too tasty to pass up. I've not used code for a project yet but I guess its time to start that learning curve! Thanks for the idea.

Goblynn93

• Posts: 29
• Joined: Sun Sep 23, 2018 2:13 pm
• Real Name: Brian Lynn
Frank Feijen wrote:Or if you prefer to do it mathematically, with a polygon node (adjust lengthsides-value on the controls-tab):

Holy cow... thank you! This is way more than I expected for help!

Goblynn93

• Posts: 29
• Joined: Sun Sep 23, 2018 2:13 pm
• Real Name: Brian Lynn
Pardon my ignorance but how do I use this code? Are these Fuses? Lua? I've never done anything like this with Fusion and not sure where to apply it. I get errors if I try and use it as a Script...

Thanks for the help! I'll figure this out.

Frank Feijen

• Posts: 70
• Joined: Tue Dec 13, 2016 10:04 am
• Location: Vilvoorde, Belgium
Just copy/paste them into the flow-area and thou shall witness them nodes appearing
It really is as simple as that : )

Goblynn93

• Posts: 29
• Joined: Sun Sep 23, 2018 2:13 pm
• Real Name: Brian Lynn
Frank Feijen wrote:Just copy/paste them into the flow-area and thou shall witness them nodes appearing
It really is as simple as that : )

woah... really?? its just like that??

and here I've been struggling to figure out Scripts for Tools and Comps and other stuff!

loving Fusion more and more each day.

Bryan Ray

• Posts: 751
• Joined: Mon Nov 28, 2016 5:32 am
• Location: Los Angeles, CA, USA
Frank Feijen wrote:If you have the studio-version, you might be able to do this with FUIcircles?

Fuses don't require Studio. They work in the free version.

I've also got a training Fuse available with a regular polygon mode that can create an equilateral triangle. http://www.bryanray.name/files/BoS_LessonEight.fuse
Bryan Ray
http://www.bryanray.name
http://www.musevfx.com

Goblynn93

• Posts: 29
• Joined: Sun Sep 23, 2018 2:13 pm
• Real Name: Brian Lynn
Bryan Ray wrote:
Frank Feijen wrote:If you have the studio-version, you might be able to do this with FUIcircles?

Fuses don't require Studio. They work in the free version.

I've also got a training Fuse available with a regular polygon mode that can create an equilateral triangle. http://www.bryanray.name/files/BoS_LessonEight.fuse

Where do you even find fuses? Searching on Google for Fusion Fuses gets me a ton of info on Ford parts... Trying to find the FUI_Circles mentioned above and having zero luck...

Frank Feijen

• Posts: 70
• Joined: Tue Dec 13, 2016 10:04 am
• Location: Vilvoorde, Belgium
Don't tell me you havent installed reactor yet....

https://forum.blackmagicdesign.com/viewtopic.php?f=22&t=69211

@Bryan: thanks for the correction on fuses!

Goblynn93

• Posts: 29
• Joined: Sun Sep 23, 2018 2:13 pm
• Real Name: Brian Lynn
Frank Feijen wrote:Don't tell me you havent installed reactor yet....

https://forum.blackmagicdesign.com/viewtopic.php?f=22&t=69211

@Bryan: thanks for the correction on fuses!

What is Reactor? I saw it on the SteakUnderwater page but it wasn't very obvious what its for...

I'm slowly converting from After Effects to Fusion... Most of the graphical based stuff, the nodes and settings, etc, are all very straight forward for someone coming from AE or Blender or other 3d packages. That part of Fusion is very easy for me.

I'm loving the learning process though. I haven't felt this challenged or behind the curve in decades!

**after install**
Would be nice if #1 of the FAQ was "What is Reactor" with the same short message you get during install - that tells you exactly what Reactor is!

***after using***
Reactor is really amazing... I'm confused as to why after all the learning and tutorials its taken me this long to hear about this. Wondering how many other really cool plugins and external tools I might be missing! Thanks for this, its going to change things a bit for me!

Goblynn93

• Posts: 29
• Joined: Sun Sep 23, 2018 2:13 pm
• Real Name: Brian Lynn
Bryan Ray wrote:
Frank Feijen wrote:I've also got a training Fuse available with a regular polygon mode that can create an equilateral triangle. http://www.bryanray.name/files/BoS_LessonEight.fuse

This is really cool. Thanks for sharing! The triangle looks like its based on the circle and might just have the parts I need.

Of course now that I've been introduced to Reactor I might not even need to build what I was going to build... maybe already built!

Bryan Ray

• Posts: 751
• Joined: Mon Nov 28, 2016 5:32 am
• Location: Los Angeles, CA, USA
Exactly. If you want the nuts and bolts, it starts with a radial distance field (a grayscale image in which the pixels get brighter as they get further away from the center control) and uses some polar math wizardry to distort that field into a polygonal shape. Then do a threshold on the field, and you get your polygon.

Since you're just getting started in Fusion, I won't recommend diving into Fuse writing quite yet, but if you're at all interested in graphics programming, I have a sort-of tutorial series on writing OpenCL Fuses on my blog here:

http://www.bryanray.name/wordpress/opencl-fuses-index/
Bryan Ray
http://www.bryanray.name
http://www.musevfx.com