POV-Ray : Newsgroups : povray.text.scene-files : [Minimum Volume] Bounding Ellipsoid via SVD Server Time
28 Mar 2024 09:27:06 EDT (-0400)
  [Minimum Volume] Bounding Ellipsoid via SVD (Message 11 to 20 of 34)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: jr
Subject: Re: [Minimum Volume] Bounding Ellipsoid via SVD
Date: 6 Nov 2019 17:05:00
Message: <web.5dc3428af7b9a3affeeb22ff0@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> > the latter, I'm confident, although somewhat unsure of exact syntax.
>
> OK - I just usually search-engine my way to a solution   :)

can be v productive.

> > suggestion: attach your working version of svd.cpp, so we talk same code.  I'll
> > play with it here to test; are the matrices filled just with floats?
>
> Right on.
> At the moment, my thoughts are:
>
> 1. the data must get read into a faux-matrix std::vector container, which I
> suppose has to be created before assigning the data to it
>
> 2. it should have m rows - the number of vectors to process, and m columns - the
> first 3 are x, y, and z, and all the remaining columns are zeros

couple of thoughts before I download the file, for which thanks.

re 1.  why can you not simply change the 'generate_matrix' (I think) function,
to fill that matrix with the file values?

re 2. keep the current way of supplying the size, more flexibility; in a file
that could be the dimensions row/line before the data lines.


> Then hopefully I can use that lesson to apply the SVD output to the data in the
> SDL scene.
>
>
> There's hardly any data in the header file - I'm assuming that can just be added
> to the top of the .cpp file to keep it all self-contained.

not sure I follow.


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: [Minimum Volume] Bounding Ellipsoid via SVD
Date: 6 Nov 2019 17:40:01
Message: <web.5dc34ad8f7b9a3af4eec112d0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> re 1.  why can you not simply change the 'generate_matrix' (I think) function,
> to fill that matrix with the file values?

Well that's what I meant by
"Should I supply a filename and loop down the rows, reading in x, y, and z?"

> re 2. keep the current way of supplying the size, more flexibility; in a file
> that could be the dimensions row/line before the data lines.

Why not just read in the first value of the file which will be the number of
vectors...

> > There's hardly any data in the header file - I'm assuming that can just be added
> > to the top of the .cpp file to keep it all self-contained.
>
> not sure I follow.

SVD_BW.cpp has:
#include "stdafx.h"

but all that file has is :

#pragma once           (whatever that is) and
#include <stdio.h>

So, can't I just copy/paste those lines to the top of the .cpp file and do away
with the #include "stdafx.h" ?


Post a reply to this message

From: jr
Subject: Re: [Minimum Volume] Bounding Ellipsoid via SVD
Date: 6 Nov 2019 18:10:01
Message: <web.5dc351fcf7b9a3affeeb22ff0@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> > re 1.  why can you not simply change the 'generate_matrix' (I think) function,
> > to fill that matrix with the file values?
> Well that's what I meant by
> "Should I supply a filename and loop down the rows, reading in x, y, and z?"

if you read everything from std::cin you won't need to bother with file name
handling, just do something like
  $ ./a.out < mydata.xyz

> > re 2. keep the current way of supplying the size, more flexibility; in a file
> > that could be the dimensions row/line before the data lines.
>
> Why not just read in the first value of the file which will be the number of
> vectors...

we're talking the same thing.  :-)  the size of your matrix, followed by the
data values.

> > > There's hardly any data in the header file - I'm assuming that can just be added
> > > to the top of the .cpp file to keep it all self-contained.
> > not sure I follow.
>
> SVD_BW.cpp has:
> #include "stdafx.h"
>
> but all that file has is :
>
> #pragma once           (whatever that is) and
> #include <stdio.h>
>
> So, can't I just copy/paste those lines to the top of the .cpp file and do away
> with the #include "stdafx.h" ?

my (elderly) gcc manual does not list '#pragma once' but the clue seems to be in
the name.  as to 'stdafx.h' -- it's not a "standard header" here, Windows
perhaps?  I'd get rid of the include, and 'stdio.h' is probably included
already.

anyway, the source you posted does not compile, so it's clearly not meant to be.
 on a different subject, when will there be news/code for the pulley stuff?
thinking that, with minor modifications, it would be useful for modelling
tracked vehicles.  :-)


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: [Minimum Volume] Bounding Ellipsoid via SVD
Date: 6 Nov 2019 18:55:01
Message: <web.5dc35cc2f7b9a3af4eec112d0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

>   $ ./a.out < mydata.xyz

Righteous.


> my (elderly) gcc manual does not list '#pragma once' but the clue seems to be in
> the name.


Specifies that the compiler includes the header file only once, when compiling a
source code file.
Syntax
#pragma once

The use of #pragma once can reduce build times, as the compiler won't open and
read the file again after the first #include of the file in the translation
unit. It's called the multiple-include optimization. It has an effect similar to
the include guard idiom, which uses preprocessor macro definitions to prevent
multiple inclusions of the contents of the file.

Commenting out the include doesn't affect the compile, so good to go.

> anyway, the source you posted does not compile, so it's clearly not meant to be.

my command line directive is:

c++ SVD_BW.cpp -std=c++11

Not sure what your system is spitting out as complaints.

I can give you the current version of the tangent macro, and hopefully that will
be all you need.  Looks like Leroy couldn't help himself and has his own version
going as well. :D

I hope the lesson pdf clarifies the whole point of all of this and to some
extent how it's done.


Post a reply to this message

From: jr
Subject: Re: [Minimum Volume] Bounding Ellipsoid via SVD
Date: 6 Nov 2019 19:25:00
Message: <web.5dc36373f7b9a3affeeb22ff0@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> ...
> > anyway, the source you posted does not compile, so it's clearly not meant to be.
> my command line directive is:
> c++ SVD_BW.cpp -std=c++11
         ^^^
spot the difference.  ;-)  no matter though, it can wait until you've changed it
to read data from stdin.

> Not sure what your system is spitting out as complaints.
>
> I can give you the current version of the tangent macro, and hopefully that will
> be all you need.

cool, thanks.  any chance of a/the scene file?  to see it in-use.

>  Looks like Leroy couldn't help himself and has his own version
> going as well. :D

it is .. seductive.  _if_ I can understand yr code well enough, I've plans for a
platform on tank-like tracks I'd like to build.

> I hope the lesson pdf clarifies the whole point of all of this and to some
> extent how it's done.

you're pulling my leg..  had a quick scan, the formulae just make my eyes bleed.
 the 1st scan main benefit was seeing the virtual "mass", as an assumption and
how it can then be applied.  that, as a concept, is v interesting, need to think
on it.


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: [Minimum Volume] Bounding Ellipsoid via SVD
Date: 6 Nov 2019 20:35:00
Message: <web.5dc374c1f7b9a3af4eec112d0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> > my command line directive is:
> > c++ SVD_BW.cpp -std=c++11
>          ^^^
> spot the difference.  ;-)  no matter though, it can wait until you've changed it
> to read data from stdin.

Spot the identity.  ;P
http://news.povray.org/povray.text.scene-files/message/%3Cweb.5dc33dd7f7b9a3af4eec112d0%40news.povray.org%3E/#%3Cweb.5d
c33dd7f7b9a3af4eec112d0%40news.povray.org%3E

I don't know what construct to use to "catch" the data from stdin...
But I will look.
Hangin' it up for the day - got a day tomorrow, hopefully it's not a disaster
<crosses fingers>


> it is .. seductive.  _if_ I can understand yr code well enough, I've plans for a
> platform on tank-like tracks I'd like to build.

I'll see if I can put together a simplified version minus all the gobbledygook.


> > I hope the lesson pdf clarifies the whole point of all of this and to some
> > extent how it's done.
>
> you're pulling my leg..

Nope.
Just look at the pretty pictures.

> had a quick scan, the formulae just make my eyes bleed.
>  the 1st scan main benefit was seeing the virtual "mass", as an assumption and
> how it can then be applied.  that, as a concept, is v interesting, need to think
> on it.

Well that's basically it - don't look at the formulae.

The real gist looks to be that matrices encode (mostly) scaling and rotations.
 One matrix can be split up (factored) into a rotation matrix, a reverse
rotation matrix (which obviously cancel) and a matrix of scaling factors.

So "How is your data stretched?"  It stretches along "x" by this much, "Y" by
this much, and "z" by this much.
And the rotation matrix tells you what direction "x", "y" and "z" are from the
real, cardinal basis vectors of <x, y, z>.


Post a reply to this message

From: jr
Subject: Re: [Minimum Volume] Bounding Ellipsoid via SVD
Date: 6 Nov 2019 21:15:01
Message: <web.5dc37d9ff7b9a3affeeb22ff0@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> "jr" <cre### [at] gmailcom> wrote:
>
> > > my command line directive is:
> > > c++ SVD_BW.cpp -std=c++11
> >          ^^^
> > spot the difference.  ;-)  no matter though, it can wait until you've changed it
> > to read data from stdin.
>
> Spot the identity.  ;P
>
http://news.povray.org/povray.text.scene-files/message/%3Cweb.5dc33dd7f7b9a3af4eec112d0%40news.povray.org%3E/#%3Cweb.
5d
> c33dd7f7b9a3af4eec112d0%40news.povray.org%3E
>
> I don't know what construct to use to "catch" the data from stdin...

the program does already though.  where in main you have "std::cin >> matrix",
that's reading from stdin, after it put the message on stdout.  cin/cout/cerr ==
stdin/stdout/stderr.

> But I will look.
> Hangin' it up for the day - got a day tomorrow, hopefully it's not a disaster
> <crosses fingers>
>
> > it is .. seductive.  _if_ I can understand yr code well enough, I've plans for a
> > platform on tank-like tracks I'd like to build.
>
> I'll see if I can put together a simplified version minus all the gobbledygook.

great, cheers.

> > > I hope the lesson pdf clarifies the whole point of all of this and to some
> > > extent how it's done.
> >
> > you're pulling my leg..
>
> Nope.
> Just look at the pretty pictures.
>
> > had a quick scan, the formulae just make my eyes bleed.
> >  the 1st scan main benefit was seeing the virtual "mass", as an assumption and
> > how it can then be applied.  that, as a concept, is v interesting, need to think
> > on it.
>
> Well that's basically it - don't look at the formulae.

well, re-orienting a given object to obtain a best fit BB seems to be necessary,
so, no choices.  :-)

> ...


regards, jr.


Post a reply to this message

From: jr
Subject: Re: [Minimum Volume] Bounding Ellipsoid via SVD
Date: 10 Nov 2019 09:50:01
Message: <web.5dc82312f7b9a3affeeb22ff0@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> "jr" <cre### [at] gmailcom> wrote:
>
> > the latter, I'm confident, although somewhat unsure of exact syntax.
>
> OK - I just usually search-engine my way to a solution   :)
>
> > suggestion: attach your working version of svd.cpp, so we talk same code.  I'll
> > play with it here to test; are the matrices filled just with floats?
>
> Right on.
> At the moment, my thoughts are:
>
> 1. the data must get read into a faux-matrix std::vector container, which I
> suppose has to be created before assigning the data to it
>
> 2. it should have m rows - the number of vectors to process, and m columns - the
> first 3 are x, y, and z, and all the remaining columns are zeros
>
> Then hopefully I can use that lesson to apply the SVD output to the data in the
> SDL scene.
>
>
> There's hardly any data in the header file - I'm assuming that can just be added
> to the top of the .cpp file to keep it all self-contained.

it's been .. quiet.  in case you haven't addressed 1/2 yet, here's a quick,
though inefficient (and inelegant), hack.  in the 'generate_matrix' function,
there's an assignment in the innermost 'for()'.  if you change that line to
read:
  std::cin >> matrix[row[col];
then you can pipe your data in.  inefficient because you're reading one value at
a time.  say you want a 2x2 matrix:
1.0 2.0
3.0 4.0

then your data file should read:
2
1.0
2.0
3.0
4.0

and you'd execute:
$ ./a.out < myfile

while I haven't actually tried it here, I'm quite confident it'll work.  in the
long run you'd want to read and process a row of data at a time though.  hth.


regards, jr.


Post a reply to this message

From: jr
Subject: Re: [Minimum Volume] Bounding Ellipsoid via SVD
Date: 10 Nov 2019 10:10:01
Message: <web.5dc82730f7b9a3affeeb22ff0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> ...
> it's been .. quiet.  in case you haven't addressed 1/2 yet, here's a quick,
> though inefficient (and inelegant), hack.  in the 'generate_matrix' function,
> there's an assignment in the innermost 'for()'.  if you change that line to
> read:
>   std::cin >> matrix[row[col];

uh, typo.  effing always.  :-(

std::cin >> matrix[row][col];

> ...


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: [Minimum Volume] Bounding Ellipsoid via SVD
Date: 10 Nov 2019 18:40:00
Message: <web.5dc89f2df7b9a3af4eec112d0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> > it's been .. quiet.

Well, been busy with RL, reading, re-reading, watching vids, filtering, taking
notes, processing, etc.

I think I have enough of an understanding of what goes on and what to do with
it, that it ought to be a viable method.

Will start a new thread in pbi so I can show results.

Thanks for the line of code - that will be the next step after some more
tinkering:  packaging it up into an easy to use utility.


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.