← Back to team overview

yade-users team mailing list archive

Re: [Question #692956]: Implementing orbital motion

 

Question #692956 on Yade changed:
https://answers.launchpad.net/yade/+question/692956

Janek Kozicki posted a new comment:
Hi, this is a very nice idea.

If you want the qglviewer camera to follow your debirs you can for
example use function https://yade-
dem.org/doc/yade.qt.html#yade.qt._GLViewer.center , I didn't try how it
works when invoked from a python script inside an Engine loop though. I
didn't expect such kind of use for this function. So we might need to
improve it a little bit. Or maybe add some alternative toggle to always
recenter in C++ before a redraw.

I admit that the class name FieldApplier is very tempting when thinking
about gravitational filed. It is a base class for all other *Engines
that are supposed to apply some forces: https://yade-
dem.org/doc/yade.wrapper.html#fieldapplier

CentralGravityEngine does not depend on distance: https://gitlab.com
/yade-dev/trunk/-/blob/master/pkg/common/GravityEngines.cpp#L51

You will need to write your own derived class to do what you want:

>  Is there a way to define a force field using a fuction for position.
The FieldApplier looks promising, but how do I use it?

Yes, exactly. Derive a class from it and make it apply some defined
force field. You can hardcode force field in C++, or use overrideble
virtual functions to be able to write function formula inside python:
https://yade-dem.org/doc/prog.html#subclassing-c-types-in-python

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.