toxiclibsjs icon indicating copy to clipboard operation
toxiclibsjs copied to clipboard

VerletParticle for 3D usage

Open oguzy opened this issue 14 years ago • 14 comments

Only 2D version seemed to be implemented.

oguzy avatar Jun 18 '11 15:06 oguzy

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

hapticdata avatar Jun 18 '11 21:06 hapticdata

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
  • [x] PullBackSpring3D
  • [x] VerletConstrainedSpring3D
  • [x] VerletMinDistanceSpring3D
  • [x] VerletParticle3D
  • [x] VerletPhysics3D
  • [x] VerletSpring3D

behaviors

  • [x] AttractionBehavior3D
  • [x] ConstantForceBehavior3D
  • [x] GravityBehavior3D
  • [x] ~~ParticleBehavior3D~~

constraints

  • [x] AxisConstraint
  • [x] BoxConstraint
  • [x] CylinderConstraint
  • [x] MaxConstraint
  • [x] MinConstraint
  • [x] ~~ParticleConstraint3D~~
  • [ ] PlaneConstraint
  • [ ] SoftBoxConstraint
  • [ ] SphereConstraint

dependacies

  • [x] ParticlePath3D: Spline3D
  • [x] Spline3D: BernsteinPolynomial
  • [x] Spline3D: LineStrip3D
  • [x] AxisConstraint: Vec3.Axis
  • [x] BoxConstraint: Ray3D
  • [x] CylinderConstraint: AxisAlignedCylinder
  • [x] 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

rc1 avatar Aug 16 '13 14:08 rc1

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.

hapticdata avatar Aug 18 '13 21:08 hapticdata

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.

rc1 avatar Aug 18 '13 21:08 rc1

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!

hapticdata avatar Sep 26 '13 19:09 hapticdata

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

rc1 avatar Sep 26 '13 20:09 rc1

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!

aatishb avatar Jan 15 '16 14:01 aatishb

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.

hapticdata avatar Jan 15 '16 21:01 hapticdata

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

aatishb avatar Jan 15 '16 21:01 aatishb

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

rc1 avatar Jun 08 '16 09:06 rc1

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.

thesnups avatar Feb 05 '17 02:02 thesnups

@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.

rc1 avatar Feb 05 '17 13:02 rc1

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

hapticdata avatar Feb 06 '17 20:02 hapticdata

@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.

hapticdata avatar Feb 08 '17 20:02 hapticdata