|
|
William F Pokorny <ano### [at] anonymousorg> wrote:
>...
> I noticed in your vectors.inc the indenting occasionally varies. It
> looks like you mostly use increments of four - which is very common -
> but OrthogonalVector, for example, uses three. I'd guess because it was
> that in math.inc ?
Yes, sorry about that. I hope I've fixed it now.
Years ago, when I had a tiny monitor, I used 2 spaces for indentation. Now I
prefer 4. 3 is very odd ! And I really hate indentation with TABs. (Because
stuff jumps around - and very seldom ends up where it looks consistent and
nice.) The Golang linter use TABs for indentation, so it's not very likely that
I will love to program in Go.
> I've been looking more at your Mean, Variance, Minimum, Maximum,
> PrintStatistics, and Histogram suggestions.
Good. I'm not sure if I like that the minimum and maximum values in the
Histogram macro always ends up at the "edges" of the outer bins. Perhaps someone
well-versed in statistics can give some advice here.
> First, issue I hit was
> testing your comments about vectors.
>
> // Does also work for vectors
> #macro Mean(Values)
> ...
>
> However, dimension_size() expects an array identifier. Is there some
> trick to getting vectors to work with dimension_size()? As far as I
> know, the dimension* SDL keywords work only with array identifiers and
> 'defined on call' arrays. The latter meaning:
>
> Mean(array {0.1,0.2,0.3,0.4,0.5})
>
> is OK to do. Yes, this last bit is a little more than what our current
> documentation says you can do.
>...
Try this:
#declare SomeVectors2D =
array[5] {
< 1, 5>,
<-2, -2>,
< 6, 3>,
< 0, 2>,
< 3, -1>
}
;
#declare vMean2D = Mean(SomeVectors2D);
#declare vVariance2D = Variance(SomeVectors2D);
#debug "\n\n"
#debug concat("<", vstr(2, vMean2D, ", ", 0, -1), ">")
#debug "\n"
#debug concat("<", vstr(2, vVariance2D, ", ", 0, -1), ">")
#debug "\n\n"
#declare SomeVectors3D =
array[5] {
< 1, 5, 3>,
<-2, -2, 0>,
< 6, 3, -4>,
< 0, 2, 2>,
< 3, -1, -5>
}
;
#declare vMean3D = Mean(SomeVectors3D);
#declare vVariance3D = Variance(SomeVectors3D);
#debug "\n\n"
#debug concat("<", vstr(3, vMean3D, ", ", 0, -1), ">")
#debug "\n"
#debug concat("<", vstr(3, vVariance3D, ", ", 0, -1), ">")
#debug "\n\n"
#error "Finished"
- and so on...
--
Tor Olav
http://subcube.com
https://github.com/t-o-k
Post a reply to this message
|
|