How are splines stored as xml in the .jas file?

How are splines stored as xml in the .jas file?

Hi all,
does anybody know, in what format the points and control points of a spline are stored in the .jas file?
As the spline editing tools are sparse and as we do not have access to these points from scripting (we have acces to the tesselated spline - I know), I had the idea to write some external program that modifies the spline in the xml file in order to make certain 3D-spline editing operations easier.
I have spotted, where this information is stored in the xml-file

(the code segment looks something like:
<array>
<dict>
<key>pathops</key>
<data>
AAAAAAAAAAA/gAAAAAAAAL5MzM0+TMzNPczM
zQAAAAAAAAAAAAAAAL5MzM2+mZmWPczMzQAA
AAIAAAAAP4AAAD+AAAC+TMzNvczMzT3MzM0/
TMzMPkzMzT3MzM0/TMzMvczMzT3MzM0AAAAC
AAAAAD+AAABAgAAAvkzMzT5MzM09zMzNv5mZ
mr3MzM09zMzNv5mZmj5MzM09zMzN
</data>
<key>pathopscount</key>
<integer>3</integer>
</dict>
</array>
)

and I think to have figured out, that a point with its two control points in a Bezier spline, is represented by 2 text lines of 36 characters each. However I failed to figure out, how the (probably double precision) numbers are converted into the alphabet "+, /, =, 0..9, A..Z, a..z" ...
Then, I was guessing some common method to be employed however, I was not able to find anything in the internet.

If anybody can give me a hint, I would appreciate it (certainly, Martin knows about, but he might be busy perfecting and extending Cheetah3D).

Herbert
 
Hi Herbert
* Re: FineTuning of splines.
* This is not an answer to scripting as I have no understanding of the XML encoding of relevant parameters. It is meant as a note to any newbies who may check this thread on spline manipulation.

* My workflow is:
* Apply point recording of the individual splines of a construct
* FineTune using the widget thingy in the view port (position, scale, rotate) plus adjust tangential handles (depending on the type of spline)
* If needed, use multiple panels for viewing / toggle off the display of meshes / use layers to hide temporarily unimportant splines for ease of composition
* If required, refine positions in the transform panel by numeric input or scrubbing the small pointer buttons
* I am also using the new loft creator in combination with Hiroto´s (?, but I assume) Java script to flow a mesh onto a guiding rail / axial support spline

* This works quite well with a current project on early embryology, where I model the development from a single cell (= fertilised ovum) to the embryo at about 6 weeks.

* As stated above, nothing to do with spline scripting. I did find an ancient .js on Lorenz attractors, if it is of any use to you.

Servus aus Wien :tongue:
 

Attachments

  • SS #1.png
    SS #1.png
    183.3 KB · Views: 269
  • Lorenz.js.zip
    1.3 KB · Views: 199
  • LorenzAttractor SS.jpg
    LorenzAttractor SS.jpg
    205.1 KB · Views: 262
Last edited:
Hi Podperson, hi Helmut,
Podpersons hint helped me: When I change the file ending of a cheetah3d-file from .jas to .plist, XCode nicely opens the file in a good redable format.
Here the spline data are available in hex format and this helped me to figure out the details (only checked this for Bezier Spline):
- all data should be interpreted as 32 bit entries
- each spline point starts with four "steering" numbers followed by the 3 coordinates of a) bezier point, b) control point 1, c) control point 2, interpreted as single precision float.
- the "steering" numbers are 0.0, 0.0, 1.0, 0.0 for the start point,
hex 00000002, 0.0, 1.0, 1.0 for the first point,
hex 00000002, 0.0, 1.0, 2.0 for the second .....
- the meaning of the first three "steering" entries are unclear to me, the last entry is probably used for sorting (in case ...)
- I also guess that the control points of the first bezier point are not used - at least, if there is only one subpath
- when adding/deleting points in the XML-file, one should also adjust the XML-entry "pathopscount" that denotes the number of points in the case of a bezier spline
- thanks to Podperson I was also able to figure out the encoding/decoding of the binary data: It seems that apple is using Base64-encoding.

So, now I am ready to try to make something useful.


Herbert
 
Hi Herb,
that should answer your remaining questions:

- each spline point starts with four "steering" numbers followed

1st: int , values 0=Move or 2=Curve
2nd: BOOL, bitmask encodes selection
3nd: float, NURBS knot (should be 0.0, 1.0, 2.0, 3.0, ...)
4nd: float, NURBS weight (not used anymore)

Bye
Martin
 
Hi Martin,
thank you for the additional information.
As the images show (its not at all artistic, I know :smile:), programmatically creating and editing 3D-splines would be quite handy (I am thinking for example to programmatically insert some 50 equidistant points in between two existing and so on ...).
However, I do not yet have a suitable user interface and .....

Herbert
 

Attachments

  • ExternalSpline Example.jpg
    ExternalSpline Example.jpg
    49.7 KB · Views: 238
  • ExternalSpline Example2.jpeg
    ExternalSpline Example2.jpeg
    53.5 KB · Views: 216
Hi Frank,
thank's for the hint - I know about and have used it many times.
However, the main goal was to find a way to modify existing splines programmatically, which is not possible through scripting, exept by using its tesselated form, which essentially kills the elegance of the spline approach.
For a long time I would have wished Martin to give us access to the points and control points of splines through scripting. But, as only few of us would use it and as he pushes other things, I searched for different approach.
Figuring out how to read and write spline data into the text based .jas file, I also got access to a large number of math tools and functions existing in Python, Matlab and other scientific software. For example to calculate the points of the spline displayed I used complex numbers, which might not be available java script engine implemented.

Cheers
Herbert
 
Sounds like an integrated SVG editor for parametric shape generation like Inkscape, Affinity-Desgner&Co has. No idea how this could be integrated.
Good luck on your project. :icon_thumbup:

Cheers
Frank
 
It should not be SVG but 3D-splines: If I create a flat spline with 100 points in Inkscape or wherever and have to adjust the third coordinates of all points by hand :frown:

Cheers
Herbert
 
Back
Top