Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


peterbone

Member Since 15 Feb 2005
Offline Last Active Dec 13 2013 04:22 AM

Posts I've Made

In Topic: Arc calculation

12 December 2013 - 04:08 AM

Attached is a Windows demo of what I'm trying to do. This is an old version. Drag the green dot to change the line angle and drag with Ctrl to bend it. It will always stay the same length. Notice that the cursor moves away from the end as you bend it, and the end jumps when you go back to bend a bent line. That's what I'm trying to fix. If I get my new method to work with a numerical method then I'll post it as well.


In Topic: Arc calculation

12 December 2013 - 03:52 AM

ferrous, when dragging P2, the cursor won't always stay on P2 if it's dragged to a different radius. Notice in my diagram that Pc is not at P2. The cursor will be at P2 to start dragging but not necessarily during the drag. This allows the arc to stay circular with a constant length. My app works similarly when dragging a straight line to change it's angle to keep its length constant. This is for a vector graphics drawing / animation app. I want an intuitive way to position and bend constant length lines.


In Topic: Arc calculation

11 December 2013 - 09:53 AM

 

how to quickly draw the curves from the set of particles

That's the nice bit about this technique. If you want to draw e.g. a Bezier curve given the user-dragged point and some other control points, you have to do extra work to calculate the curve.

 

If you want to draw the curve after having simulated those particles, you just connect the dots. They already form a curve.

They form an approximation to a curve. Drawing it requires multiple calls to a drawing function instead of just one for the arc.

 

I know I didn't mention this previously, but I also need to store the bent line in memory in a scalable and compact way. The arc lends itself to this much better.


In Topic: Arc calculation

11 December 2013 - 07:55 AM

That sounds like a nice alternative Crossbones. Although I'll have to think carefully about how many particles there should be at different scales and also how to quickly draw the curves from the set of particles. I may need to draw hundreds of these curves per frames, so just drawing an arc may be the faster method.


In Topic: Arc calculation

11 December 2013 - 05:05 AM

Thanks for your help. Raigan, P2 is unknown. Ferrous, yes r is unknown too. I've already played with Bezier curves but they require even more numerical solutions because the length is not constant. You need a numerical method to work out the length and another to move the control point until the length is the value you want.

 

I think the way I'll have to do it is to work out the endpoint P2 with no curvature (a1=a2), then work out the angle to the cursor (Pc) from P2, then work out P2 again, and repeat until it converges. I think it will converge quickly this way.

 

I've already done it a different way where a2 is calculated from Pc and the midpoint of the unbent line. The problem with this is that the cursor leaves P2 while dragging when the line is bent. When you go back to adjust P2 again it will jump to different position.

 

Edit: I've added an image to my post above.


PARTNERS