plasm-language / pyplasm

http://www.dia.uniroma3.it/~paoluzzi/plasm502/
Other
54 stars 24 forks source link

Documentation? #26

Closed croros closed 3 years ago

croros commented 4 years ago

Hello,

I think I'm missing something, but where can I find documentation for pyplasm? I can't seem to find anything on plasm.net other than a tutorial for normal PLaSM. I was wondering if there was a way to save models made with PLaSM to a file.

Thank you

scrgiorgio commented 4 years ago

Prof Alberto Paoluzzi will reply to this question (http://paoluzzi.dia.uniroma3.it/)

apaoluzzi commented 4 years ago

You have several alternatives:

  1. symbolic exporting. The Plasm code IS the model, and can be re-evaluated on another machine, providing it encloses a Plasm interpreter;
  2. numeric exporting. When evaluated, a Plasm model generates an HPC value. This one can be translated by the UKPOL function (the inverse of MKPOL) into a triple sequence of points, convex cells (indexing vertices), and polyhedral cells (indexing convex cells);
  3. VRML exporting. It should yet work, but are now more than 12 years that I do not make a try ...

A better alternative is to use the pyplasm module in Python. Just look at the src/fenvs.py file in the distribution, to see how most of Plasm functions were translated to Python, together with simple examples.

Anyway, the best documentation for the "classic" Plasm is in the book GP4CAD (Geometric Programming for Computer-Aided Design) by Wiley, 2004. Currently I'm working to bring the Plasm ideas to Julia language.

In case of need you may write to me exposing your problem, and I can suggest you a possible solution.

apaoluzzi commented 3 years ago

On Jul 23, 2019, at 6:18 PM, scrgiorgio notifications@github.com wrote:

Prof Alberto Paoluzzi will reply to this question (http://paoluzzi.dia.uniroma3.it/ http://paoluzzi.dia.uniroma3.it/)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/plasm-language/pyplasm/issues/26?email_source=notifications&email_token=AAG2COMKRESWIF4JODEVK7DQA4VMBA5CNFSM4IF7AW5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2TU5IY#issuecomment-514281123, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG2COOLQNWQYF35SXD7CS3QA4VMBANCNFSM4IF7AW5A.

The best way to save a pyplasm model is to save the generating source program itself. Normally the evaluation time of a source program is similar ato the one needed to read data from disk. In fact the pyplasm interpreter is written in C++, and is very fast.

A second way is to save the HPC (Hierarchical Polyhedral Complex) geometric data structure that every pyplasm model is made of. The needed function is UKPOL(model) i.e. "UnMake Polyhedron", to write on a file in the standard way. In this case you may read it as a list of data to be given as input to expression model = MKPOL(list)

Finally you may output or view a 3D model using the graphic .OBJ file format. To see how please read the "pyplasm/resources/examples/load_obj.py" and the other examples.For more documentation and examples of use, to look at the file "pyplasm/src/xgepy/fenvs.py" may be useful.

Enjoy pyplasm !