# Connect two points with a line

Hello, everyone,
I need your help for my future project.
I want to connect two points with each other with a line.
But the dots move differently in a circle! The line should always be connected to the two points, in other words the line will be compressed and stretched (like a rubber band).
Is that technically possible at all???
I would be grateful for any suggestion, tip and help

1 Like

You should see if @Zieneth will help you . Look at his recent work you will be astounded . The other master is @bradtc . They are Busy People be Patient .

3 Likes

Make your WIP Inspectable. I guess you are using Rotation Formulas to move the dots. Paradoxically if you used the sin cos x y method yo would be part of the way there. What you are asking to do is remarkably Complex.

1 Like

First I would replace your two balls with with orbital expressions so that you are not using rotating â€śhandsâ€ť expressions to locate them.

That will give you two XY coordinates for the two balls, and then the distance between the two balls can be calculated with simple algebra to get the length of the line:
Hypoteneuse^2=deltaX^2+deltaY^2
Hypoteneuse=((deltaX^2)+(deltaY^2))^(0.5)

Use that to make a rectangle with the origin at the outer ball XY location, of height say 2 or however thick you want the line, then of the width calculated above.

Next you have to calculate the rotation angle using the atan formula.
rotation =(atan((deltaY)/(deltaX)))

Be warned the expressions may get big and you can work them out in notepad++ and then paste it in. Use lots of brackets or else negative values will pop up giving weird results.

Also note the atan function now works on the watch, if you search atan in the forum, you get some crazy formulas, which work, but use atan now that it has been fixed in the watch app v6 onward.

4 Likes

hmmm, interestingâ€¦
I was just going to say, in geometry you would define a line by 2 end points, or a point and a vector, but in Facer it would be an element with one point, a length, and rotation. You have to think differently hereâ€¦ @bradtc : way to go!

3 Likes

Tom you are talking about a Cartesian Environment like CAD . XYZ . Unfortunately I do not know what the name is of what we do on Watches but it is all based on Radians from Centre Points . I hate radians . Oh well . I love the lesson that Brad Gives . That is exactly what we are supposed to do rather than diving in and sorting it with a test . All Brads work is inspectable and a fine working example of what he has outlined here . He is just to modest to blow his trumpet over it . If I was not so busy I would have a Go so this Becomes a Bookmarked topic for next Year . The Best Topics have The best Titles .

4 Likes

I have actually been working on drawing a line between orbiting objects. I absolutly use notepad when working with large equations. Iâ€™ll share here when I have something, unless youâ€™ve got it

3 Likes

You can inspect this one. Pretty basic, but youâ€™ll find the line pivots off center. This can be corrected by dynamically adding or subtrcting from the orbit- (line thickness/2).
Using the retange object also alows for a dynamic length.
You could use similar code (or this exactly) as is, becuse 1, the screen is pretty small, and 2, some creative masking would hide the wobble. Have fun

6 Likes

Oh dear, I had such mathematics about 35 years ago.
Hopefully I can still get this togetherâ€¦ puh

2 Likes

Nice one Mr Zieneth Starâ€¦ I see an X-ray vision of a V8. Thanks for sharing you Genius :::)))

BTW You did not really have to have the Dot in the centre to prove the Gag.

1 Like

Yeah, the center dot was just a reference point.
Up next, the Pantagraph lol

1 Like

Some pantograph hands to go with Square or Round Faces:::)))

1 Like

@daredevill Check the battery hand on this one. The line changes size dynamically with the changing size of the battery indicator drawing to a spiraling point. Inspection is enabled so you can give it a good look. Please let me know what you think, I rarely get feedback other than from @russellcresser lol.

7 Likes

Looks amazing! I need more time to study the mathâ€¦ But just looking at the formulas it does not seem that complicated, itâ€™s just ingenious. Well done!

3 Likes

Thank you for the feedback, I appreciate it

2 Likes

@Zieneth
Wow, amazingâ€¦
It comes pretty damn close to what I had in mind.
Iâ€™ll try to implement it tomorrow and replace it with minutes and seconds.

A very good job

2 Likes

I made this test like a year ago, does exactly what you want so it seems:

3 Likes

Wowâ€¦ yes thatâ€™s exactly itâ€¦ Thank you @ThaMattie .
Now I just have to provide the right balls with the right values and positions.

2 Likes

I made this one as a combination of a couple different ones. There is a cople tricks youâ€™ll find.
Happy coding.

9 Likes

That Tourbillon is Really Flying. You are a Real Magician Sir. A real Privilege to be any where near such Genius :::)))

2 Likes