[x3d-public] JinLOA4 and the giant shrinking machine
John Carlson
yottzumm at gmail.com
Sun May 29 13:13:15 PDT 2022
Joe,
If you want to find the archived thread for context, try searching for
“giant shrinking machine”. I believe this was a personal conversation, and
i may need to resend, or otherwise make a link available for download (your
choice, Joe).
I’m sorry if I dropped the ball and did not pursue this a bit more last
year.
These messages are in reference to shrinking the JinLOA4 example in the
archives.
Thanks!
John
On Sun, May 29, 2022 at 3:00 PM John Carlson <yottzumm at gmail.com> wrote:
> Here is latest jar/zip, i hope.
>
>
> ---------- Forwarded message ---------
> From: John Carlson <yottzumm at gmail.com>
> Date: Tue, Sep 7, 2021 at 12:32 AM
> Subject: Re: JinLOA4 and the giant shrinking machine
> To: Joseph D Williams <joedwil at earthlink.net>
>
>
> Updates attached.
>
>
> John
> On 9/6/21 5:00 PM, Joseph D Williams wrote:
>
>
>
> Hi John.
>
> OK, first look at the user code and see that there is a comment with
> height declared.
>
> Now look at the Humanoid root node and see the joint center location,
> which in reality is intended to be approximately a model contact point when
> sitting, but is dimensioned for standing, standard default pose in a
> coordinate system where I equals 1 meter.
>
> So from the joint center for root, we could just say that this feature is
> about halfway up so its y axis should be about ½ of the stated model
> height, so we could figure out how to change the y value of the root to
> some number that represents a human space value for the root joint center.
> If we used that same factor for the other joint centers, then at least the
> joint center y values would be rescaled to ‘human’ dimensions.
>
> So, please look at the existing model and figure how to rescale the x y z
> values of the given skeleton joint center model to an ’idealized’
> ‘standard’ skeleton human-scale dimensions, as given in Annex A, for a
> humanoid about 1.86 metres tall.
>
>
>
> I’m not sure about what you sent, maybe send example of input and output.
> I can read json, I think. Do you have json transcoding for the jinloa4
> model?
>
> Thanks.
>
> Joe
>
>
>
> *From: *John Carlson <yottzumm at gmail.com>
> *Sent: *Monday, September 6, 2021 3:44 AM
> *To: *Joseph D Williams <joedwil at earthlink.net>
> *Subject: *JinLOA4 and the giant shrinking machine
>
>
>
> Joe, once I started using JSON for the encoding, things became MUCH
>
> easier. I don't know who had the idea to switch from DOM/SAI to JSON,
>
> but it's a big win!
>
>
>
> Here's a script that changes JinLOA4.json to JinLOA4.txt below
>
>
>
> Please review.
>
>
>
> Haven't viewed yet. That's next.
>
>
>
> Not sure if the people are supposed to be 1m or 2m tall. Let me know.
>
>
>
> I haven't dealt with units yet.
>
>
>
> John
>
>
>
> ===========================================================
>
>
>
> "use strict";
>
>
>
> const fs = require('fs');
>
>
>
> const files = [ "JinLOA4.json" ];
>
>
>
> let globalScale = [ 1, 1, 1 ];
>
> let height = 1;
>
>
>
> function browse(obj) {
>
> if (typeof obj === 'object') {
>
> for (let o in obj) {
>
> if (o === '@translation') {
>
> // console.log('translation before',
>
> obj[o]);
>
> for (let i in obj[o]) {
>
> obj[o][i] *= globalScale[i];
>
> }
>
> console.log('translation after', obj[o]);
>
> } else if (o === '@center') {
>
> // console.log('center before', obj[o]);
>
> for (let i in obj[o]) {
>
> obj[o][i] *= globalScale[i];
>
> }
>
> console.log('center after', obj[o]);
>
> } else if (o === '@name' && obj[o] === 'height') {
>
> console.log('height before',
>
> obj['@value']);
>
> console.log('global scale before:',
>
> globalScale);
>
> globalScale[1] /= obj['@value'][0];
>
> console.log('global scale after:',
>
> globalScale);
>
> obj['@value'][0] /=
>
> obj['@value'][0];
>
> console.log('height after',
>
> obj['@value'][0]); // this should be 1
>
> } else if (o === '@scale') {
>
> // change scale to no scaling
>
> console.log('scale before', obj[o]);
>
> console.log('global scale before',
>
> globalScale);
>
> for (let i in obj[o]) {
>
> globalScale[i] = obj[o][i];
>
> obj[o][i] /= globalScale[i];
>
> }
>
> console.log('scale after', obj[o]);
>
> console.log('global scale after',
>
> globalScale);
>
> } else if (typeof obj[o] === 'object') {
>
> obj[o] = browse(obj[o]);
>
> }
>
> }
>
> }
>
> return obj;
>
> }
>
>
>
> for (let f in files) {
>
> let str = fs.readFileSync(files[f]);
>
> let obj = JSON.parse(str);
>
> str = JSON.stringify(obj, null, 2);
>
> // console.log(str);
>
> obj = browse(obj);
>
> str = JSON.stringify(obj, null, 2);
>
> // console.log(str);
>
> fs.writeFileSync(files[f].replace(/json/, "txt"), str);
>
> }
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220529/54c0b69d/attachment-0001.html>
More information about the x3d-public
mailing list