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

VerletParticle for 3D usage #11

Open
oguzy opened this issue Jun 18, 2011 · 14 comments
Open

VerletParticle for 3D usage #11

oguzy opened this issue Jun 18, 2011 · 14 comments
Labels

Comments

@oguzy
Copy link

oguzy commented Jun 18, 2011

Only 2D version seemed to be implemented.

@hapticdata
Copy link
Owner

yes currently only the code for VerletPhysics2D has been implemented. VerletPhysics for 3D is in the works but is not currently my top priority.

@rc1
Copy link
Contributor

rc1 commented Aug 16, 2013

Hi Kyle,
This would be great addition to the port.
After a brief look through the Java code. Here is an initial list of classes I think would need to be ported:

physics3D

  • ParticlePath3D
  • ParticleString3D
  • PullBackSpring3D
  • VerletConstrainedSpring3D
  • VerletMinDistanceSpring3D
  • VerletParticle3D
  • VerletPhysics3D
  • VerletSpring3D

behaviors

  • AttractionBehavior3D
  • ConstantForceBehavior3D
  • GravityBehavior3D
  • ParticleBehavior3D

constraints

  • AxisConstraint
  • BoxConstraint
  • CylinderConstraint
  • MaxConstraint
  • MinConstraint
  • ParticleConstraint3D
  • PlaneConstraint
  • SoftBoxConstraint
  • SphereConstraint

dependacies

  • ParticlePath3D: Spline3D
  • Spline3D: BernsteinPolynomial
  • Spline3D: LineStrip3D
  • AxisConstraint: Vec3.Axis
  • BoxConstraint: Ray3D
  • CylinderConstraint: AxisAlignedCylinder
  • SphereConstraint: Sphere

I was thinking to give this a go. But before I do I have some questions:

  • Does this list look about right?
  • Is it naive to think that this is just a case of porting the Java files (using your conventions)?
  • Is there any other gotchas, things to look out for, or things I am missing?

Thanks,
Ross

@hapticdata
Copy link
Owner

This progress + code-style looks great. Thanks for contributing and for using the internals where appropriate!

Your list looks accurate, there is no need for the interfaces. It isn't naive, the toxi.physics3d.* package is one that should be straight-forward to port. The biggest "gotcha" is circular dependencies. I don't foresee this being a problem with this package but it is the main obstacle that can complicate code organization. When it does occur it usually results in an error from the internals.extend function.

Spline3D and LineStrip3D are ported and exist currently in the develop branch. They have corresponding tests as well [1] [2]. It looks to me like all of the dependencies outside of toxi.physics3d.* have been ported already.

@rc1
Copy link
Contributor

rc1 commented Aug 18, 2013

Awesome, many thanks for the info.
I am going to finish up for tonight but it really is nearly all there. Hopefully I will get a couple of free hours to complete it soon, then play with it.

The setup/organization of your library is fantastic.

I have added two methods to the internals:

  • find
  • removeItemFromReturningSuccessfulerm, grim name sorry. Basically it mimics Java's List#remove().

If you plan to merge and would rather not have the above in the internals let me know and I will remove.

@hapticdata
Copy link
Owner

Hello @rc1 while working on the v0.2.0 release I refactored the internals. I believe the only change necessary would be that these 2 additional functions are split into their own files inside lib/toxi/internals/, and if you've used some of the internals.tests functions those references have been renamed. If at any point you want some help let me know or submit a pull request into my feature-physics3D branch and I'd be happy to lend a hand.

thanks!

@rc1
Copy link
Contributor

rc1 commented Sep 26, 2013

Hey! Sorry I have dropped the ball on this. Will try and have a look at the weekend...

@aatishb
Copy link

aatishb commented Jan 15, 2016

I was just wondering if verletphysics for 3D is currently supported. Was hoping to try it out but couldn't find any 3D examples here.
Thanks!

@hapticdata
Copy link
Owner

the Verlet Physics 3D package isnt currently in toxiclibs.js releases. A lot of the work has been done in @rc1's fork here: https://github.com/rc1/toxiclibsjs/tree/feature-physics3D which does include a examples/Physics3D_threejs.html example.

Its nearly all there, I would like to get this into toxiclibs.js proper, just need to find some time to finish it up and write some tests / examples.

@aatishb
Copy link

aatishb commented Jan 15, 2016

Thanks for the reply. That sounds great, really looking forward to seeing this incorporated. Great work on this library, it's amazing!

@rc1
Copy link
Contributor

rc1 commented Jun 8, 2016

Hey, erm.... 3 years later.

I have created a new branch for is up-to-date with the latest master. Some notes:

  • Added find to ./internals
  • Dropped the example (for now)
  • Still in the same competition state as before
  • No tests (untested)
  • Minor fix on BoxConstraint

https://github.com/rc1/toxiclibsjs/tree/feature-physics3D-updated

@thesnups
Copy link

thesnups commented Feb 5, 2017

Looks like this thread has been silent for a while. Just curious if there is any sort of timeline for adding 3D physics to this library? It would be extremely useful.

@rc1
Copy link
Contributor

rc1 commented Feb 5, 2017

@worsnupd you can try my fork. It's got most of it.

@hapticdata is there anything specific holding up a merge? Let me know if there is.

@hapticdata
Copy link
Owner

@rc1 The merge looks good. I just haven't found the time to write unit tests and finish it up at this point.

@hapticdata
Copy link
Owner

@worsnupd @rc1 The latest is now here https://github.com/hapticdata/toxiclibsjs/tree/feature-physics3D-updated including new builds. This version includes a few bug fixes and has the latest master merged in.

VerletPhysics3D will be merged into master and released once ParticlePath3D, ParticleString3D and a more thorough unit tests are completed.

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

No branches or pull requests

5 participants