Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Box2D-GR32 Cloth simulation #4

Open
GoogleCodeExporter opened this issue Nov 9, 2015 · 0 comments
Open

Box2D-GR32 Cloth simulation #4

GoogleCodeExporter opened this issue Nov 9, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

转自:
http://graphics32.org/news/newsgroups.php?
art_group=graphics32.general&article_id=10440

I have done a cloth simulation using Box2D and Graphics 32. It works pretty
well when drawing the cloth using splines and circles (for the cloth grid
nodes). It's also quite effective at filling the cloth with a bitmap image
and TBitmapPolygonFiller.

One thing that doesn't work properly or only half-works is projective
mapping of the bitmap image onto the cloth grid using
TProjectiveTransformation. This could be to do with my code, but it's more
likely to do with the fact that TProjectiveTransformation doesn't handle
non-convex rectangles. I see now why this kind of application (mapping
bitmaps onto animated shapes) is usually done with triangles -- you can't
have a non-convex triangle.

The source is available at:

http://www.anti-philosophy.co.uk/graphics/box2dclothsrc.zip

This uses GR32, Delphi Box2D V2.1, and VPR. The necessary Box2D files are
included in the source folder, but you are strongly recommended to at least
take a look at the full Delphi Box2D package (and its extensive suite of
demo programs using OpenGL). The author of the Delphi port has recently
converted the latest version of Box2D and has also added several highly
impressive new controllers for simulating explosions, ropes, and wind. I've
added a Spring controller which is included in the source for the Cloth
demo.

The full Delphi Box2D package is at

http://sourceforge.net/projects/box2d-delphi/

You can download a compiled version (500k) of the demo from:

www.anti-philosophy.co.uk\graphics\box2dclothtest.zip

See Readme.txt for instructions.

I am sure the projective mapping code can be improved and it may also be
possible to fix it to work with non-convex rectangles. The other solution
would be to adapt TProjectiveTransformation for triangles. I hope somebody
does take a look at the code and suggests improvements (I am off on holiday
from Monday so if anyone does take the project further I won't be able to 
respond
until May 10th).

Simon

Original issue reported on code.google.com by [email protected] on 4 May 2010 at 1:31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant