Opened 10 years ago

Closed 6 years ago

#1248 closed enhancement (fixed)

Trace trajectories of bodies

Reported by: asaf Owned by: asaf
Priority: Unspecified by Maintainer Milestone: Unspecified
Component: Physics Version: Unspecified
Severity: Unspecified Keywords:
Cc: garycmartin, brian Distribution/OS: Unspecified
Bug Status: Unconfirmed

Description

Add a tool that adds a "paint daub" to a body so it's trajectory gets drawn.

Attachments (2)

bounce.png (14.8 KB) - added by asaf 10 years ago.
Example of a trace
pattern.png (45.2 KB) - added by asaf 10 years ago.
Pattern formation

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by asaf

Example of a trace

comment:1 follow-up: Changed 10 years ago by asaf

  • Status changed from new to accepted

I started working on this. I'm attaching a sample. I have some questions.

*Should the paint daub be attached to the center of mass of the body?
*Should there be more than one pain daub per body?
*Should the paint color match the body's color?

(The screenshot came out a little strange)

I think it's a good idea to get the trace-painting to behave as we want it to and add the functionality to save traces to the journal later.

comment:2 in reply to: ↑ 1 ; follow-up: Changed 10 years ago by garycmartin

Replying to asaf:

I started working on this. I'm attaching a sample. I have some questions.

Could you make a clone of the git rep (there's a button in right of gitorus menu), and push you changes there. That way if I need to make a bug fix release before you're/we're done the main git rep won't be in a half edited state :-) Then once done the reps can be merged.

*Should the paint daub be attached to the center of mass of the body?

No, I'd say where ever you click. That way you can attach a paint daub say on a circle rim to generate a spiral as it rolls.

*Should there be more than one pain daub per body?

Yes. I'm not sure how the UI could indicate only one was allowed.

*Should the paint color match the body's color?

Yes that sounds like a good plan.

(The screenshot came out a little strange)

Cool :-)

I think it's a good idea to get the trace-painting to behave as we want it to and add the functionality to save traces to the journal later.

Are these dots an ever growing array of points getting rendered? If so my worry with this approach is memory and cpu speed redrawing on every frame. Could get very slow, very quickly. Drawing into a bit map and blitting that onscreen as the buffer wiper seems to give us a fixed memory footprint and render speed however many and long the trails get (though needs testing to make sure it's not too expensive for the trivial case).

comment:3 in reply to: ↑ 2 Changed 10 years ago by asaf

Replying to garycmartin:

Could you make a clone of the git rep (there's a button in right of gitorus menu), and push you changes there. That way if I need to make a bug fix release before you're/we're done the main git rep won't be in a half edited state :-) Then once done the reps can be merged.

Done

Should the paint daub be attached to the center of mass of the body?

No, I'd say where ever you click. That way you can attach a paint daub say on a circle rim to generate a spiral as it rolls.

Done

Should there be more than one pain daub per body?

Yes. I'm not sure how the UI could indicate only one was allowed.

It currently allows only one paint daub. Let's see how it works out.

BTW, I'm using an extra loop inside the activity's main loop just so I can draw the yellow dot that indicates where the paint is coming from. I'm not sure how badly it affects performance.

I'm drawing the dots into a pygame surface and then blitting that onscreen. When we start working on saving the traces it will be as easy as

pygame.image.save(trace,'trace.png')

Drawing into a bit map and blitting that onscreen as the buffer wiper seems to give us a fixed memory footprint and render speed however many and long the trails get (though needs testing to make sure it's not too expensive for the trivial case).

I think it is ready for testing but I'm not sure what you mean by the "trivial case". Also, I guess you're talking about testing it on an XO so I'll leave that to you.

PS. Added another screenshot

Changed 10 years ago by asaf

Pattern formation

comment:4 Changed 6 years ago by walter

  • Resolution set to fixed
  • Status changed from accepted to closed

Landed in v13

Note: See TracTickets for help on using tickets.