freehand curve: disconnected path

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jwkuehne
Posts: 37
Joined: Wed Nov 28, 2007 3:12 am

freehand curve: disconnected path

Post by jwkuehne » Tue Jan 21, 2014 9:29 pm

Is there a way to represent multiple disconnected paths (curves) in a single graphic object? I am aware that I can group separate graphic objects, each containing one curve, but I have found that rescaling and moving such a group, when it contains hundreds of objects, is very slow. And I have found that rescaling and moving a single object, which contains just as many points, is quite fast.

I had hoped there would be the equivalent of NaN to terminate a path and signal the next x,y pair starts a new path, so that points
1,1
2,2
3,3
NaN,NaN
10,17
11, 18
12, 19

would draw as two separate curves. This would be helpful for applications making heavy use of vector graphics, e.g. in mapping. -John

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4002
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: freehand curve: disconnected path

Post by bn » Tue Jan 21, 2014 9:56 pm

Hi jw,

you can do this with all graphic objects that have points. freehand polygon, line, and freehand.

The trick is to separate the different elements by an empty line as in your example:

Code: Select all

1,1
2,2
3,3

10,17
11, 18
12, 19
this would show two elements in your graphic. You can add as many elements as you like.

Kind regards
Bernd

jwkuehne
Posts: 37
Joined: Wed Nov 28, 2007 3:12 am

Re: freehand curve: disconnected path

Post by jwkuehne » Tue Jan 21, 2014 10:31 pm

Dear bn,

You are a genius. Off to program!
Research Engineer
McDonald Observatory, Texas

Einherjar
Posts: 18
Joined: Thu Dec 12, 2013 7:38 pm

Re: freehand curve: disconnected path

Post by Einherjar » Wed Apr 02, 2014 4:33 pm

Is there a way of using this method to create a curve?

Ideally I'm looking for a sphere so that an 'orbit' type effect will be produced - one of the projects i'm working in is a game where you have to shoot at targets circling the player in the center.

Thanks in advance!

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4002
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: freehand curve: disconnected path

Post by bn » Wed Apr 02, 2014 9:25 pm

Hi Einher,

I don't quite understand what you are trying to achieve.

Here is a stack by Jim James Hurley that draws and ellipse and has two circles on the circumference, one of them you can move manully and the other will move along.

If that is not at all what you want to do a drawing/image would help.

Kind regards

Bernd
Attachments
BallsOnAnEllipse.rev.zip
(5.63 KiB) Downloaded 275 times

Einherjar
Posts: 18
Joined: Thu Dec 12, 2013 7:38 pm

Re: freehand curve: disconnected path

Post by Einherjar » Thu Apr 03, 2014 8:38 am

That's what i'm looking for, I just want to know how to create a circle for the balls to travel around. Without inputting each point value, I'd like the balls to travel around the circle at a set speed and be autonomous.
Attachments
radial-med.jpg
radial-med.jpg (10.49 KiB) Viewed 6939 times

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4002
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: freehand curve: disconnected path

Post by bn » Thu Apr 03, 2014 10:44 am

Hi Einher,

the image explains it well.

This seems like quite an ambitious project. Lots of moving and calculating. You might want to look up what a game loop is.

http://livecode.com/academy/livecode-game-academy

here is a variation of the stack I posted above that has a basic mechanism to circle an object independently. This is a very simple example. When moving multiple parts you have to experiment to get smooth movement.

You might also want to have a look at this:
http://livecodegamedeveloper.com/

Kind regards
Bernd
Attachments
Balls on ellipse Einher.livecode.zip
(6.31 KiB) Downloaded 299 times

Post Reply

Return to “Multimedia”