# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## drawing catenary lines on a picture

Hi,

I currently draw straight lines between 2 selected controls on my FP, with 5 pixel width,and shadow.... so they look like wires.

I would prefer to join those points with a line that has some "droop"...a gravity like effect.

Are there any blocks for computing parabolic paths between 2 points ? Or has someone used a curve fitting type block to do that ?

Or better still, a catenary path (as in hyperbolic cosine)... so they have a true gravity-dependent path.

The points may be anywhere on the front panel...not just on the same axis.

Thanks for any suggestions.

===============================================================

Take a look at DATEx, FOTEx, HELEx & SIGEx add-in trainer boards for NI ELVIS 1,2 & 2+
Message 1 of 7
(638 Views)

## Re: drawing catenary lines on a picture

How about using a formual node?  cosh is supported.

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
Message 2 of 7
(626 Views)

## Re: drawing catenary lines on a picture

Here is an example of fitting to a catenary, of course my point there was that the cables of a suspension bridge follow a parabolic curve and not a catenary, but the fit is there.

http://forums.ni.com/t5/LabVIEW/VI-of-the-Day-10-7-2009-Nonlinear-Curve-Fit-VI/m-p/998262

Message 3 of 7
(606 Views)

## Re: drawing catenary lines on a picture

Thanks Darin,

This is a great example.

I need to try that curve fitting block out myself.

How are the fit parameters passed to the XY graph....Are they used to create a polynomial which is then graphed ?

Could you highlight how that happens ?

Regards,

carloman

===============================================================

Take a look at DATEx, FOTEx, HELEx & SIGEx add-in trainer boards for NI ELVIS 1,2 & 2+
Message 4 of 7
(586 Views)
Solution
Accepted by topic author carloman
08-27-2015 04:09 PM

## Re: drawing catenary lines on a picture

After the fit is performed, the parameters are passed to a Call By Reference Node which is connected to a reference of the VI which calculates the catenary curve (same one used for the fit).  The x points are generated by the Ramp VI with start and stop values determined by the max and min of the clicked points.  This way you get a smooth curve even with three data points.  This curve is then sent to the XY graph which is updated in the Timeout case of the event structure.

Message 5 of 7
(581 Views)

## Re: drawing catenary lines on a picture

Ah ha...so thats how it done.

Thanks, I get it. Very nice.

I will be able to adapt that for my own needs.

I would like my catenaries to hang more like a chain...not to have such a flat mid region.

Can you refer me to some info on what parameters to change to implement this ?

Regards.

===============================================================

Take a look at DATEx, FOTEx, HELEx & SIGEx add-in trainer boards for NI ELVIS 1,2 & 2+
Message 6 of 7
(571 Views)

## Re: drawing catenary lines on a picture

c1 is related to curvature, c2 is the vertex location, c3 is a constant offset.  You can create a termination control or constant for the LM VI, set the max iterations to 1 and it will output the curve corresponding to the initial guess.  Change the initial guesses to find the shape you like.

Message 7 of 7
(566 Views)