hermann on Mon, 11 Dec 2023 22:37:30 +0100

 Re: norml2() with variables in vector? | GP->OpenSCAD

```On 2023-12-08 17:43, Bill Allombert wrote:
```
Ah yes, qfminim only return the solution with positive first coordinates.
```If you want the others, just negate the result:
M=v~*v;S=[x|x<-Vec(qfminim(M,101)[3]),qfeval(M,x)==101];
concat(S,-S)

Cheers,
Bill.

```
```Thanks, good to know that just negation gives the others.

I wanted to visualize the 3-dimensional coordinates, and remembered
that I did that often with OpenSCAD in the past.

While "a picture says more than 1000 words", for 3D being able
to translate, rotate and zoom is the equivalent.

In order to enable a view without installing openscad,
I did screen recording with peek.

With sos=0 the vectors before mapping with matrix v are displayed.
All points are on a plane, the blue dots are with qfeval=101,
the other dots with qfeval<101. Interesting structure:
https://stamm-wilbrandt.de/images/Peek_2023-12-11_22-24.gif

With sos=1 (sum of squares) the sum of 3 squares are displayed,
which are on sphere with radius 101:
https://stamm-wilbrandt.de/images/Peek_2023-12-11_22-21.gif

\\ sos=1 displays sum of 3 squares sphere, sos=0 the pre mapping plane
\\
\\
sph(coord)=print("translate(",coord,") sphere(0.4);");
col(name)=print("color(\"",name,"\",1.0)");

v=[-102, -107, 93; 22, 23, -20; 1, 1, -1]~;
M=v~*v;
S=[x|x<-Vec(qfminim(M,101)[3]),qfeval(M,x)==101];
S2=[x|x<-Vec(qfminim(M,101)[3]),qfeval(M,x)<101];

{
print("\$fn=20;");
if(!eval(getenv("sos")),
foreach(S,s,col("blue");sph(s~));
foreach(S2,s,sph(s~))
,
foreach(S,s,
if(vecsearch(abs(s),4),col("black"));
sph((v*s)~)))
}
pi@raspberrypi5:~ \$

Regards,

Hermann.

```