octave-patch-tracker
[Top][All Lists]

## [Octave-patch-tracker] [patch #9974] [octave forge](mapping) gc2sc scxsc

 From: Philip Nienhuis Subject: [Octave-patch-tracker] [patch #9974] [octave forge](mapping) gc2sc scxsc gcxsc Date: Wed, 30 Sep 2020 17:43:32 -0400 (EDT) User-agent: Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0

```Follow-up Comment #7, patch #9974 (project octave):

Attached is my version so far, based on yours in comment #6.
I had a bit of trouble vectorizing the two stanzas, but I finally realized
that I tried it with three pair of circles all the time which led cross() to
take the wrong dimension. cross(), like dot() needs unambiguous indication of
which dimensions to work on. From then on it was not too hard.
I've also added a third output indicating the intersection status of each pair
of circles.

Comparing with Matlab, I find some consistent differences.

A perhaps small issue:
Experimenting to get two small circles with just one intersection point gives
for Octave:

>> [u, v, w] = scxsc (0, 0, 1, 0, 2, [1.0000000002340808, 1.0000000002340809]
one intersection point)

but Matlab needs:

>> [u, v] = scxsc ([0 0],[0 0], [1 1], [0 0], [2 2], [0.999998 .999999])
## ditto

Maybe Matlab seems to work with the "flat" circle radius (of the circle in the
plane that intersects the surface) where the Octave version seems to take the
radius over the surface of the sphere? Anyway it's just small differences.

A more profound issue is this:
Consider two circles with centers 90 degrees apart and then check with radii
of 44 and 46 degrees. Only the second should have intersection points.
Octave does:

>> [u, v] = scxsc ([0 0], [0 0], [45 45], [0 0], [90 90], [44  46])
:
u =
NaN   NaN
NaN   NaN

v =
NaN   NaN
NaN   NaN

and complains about coinciding circles (which they aren't, their axes are
perpendicular).
Matlab does (correctly IMO):

>> [u, v] = scxsc ([0 0], [0 0], [45 45], [0 0], [90 90], [44  46])
:
u =
NaN       NaN
7.5908   -7.5908
v =
44.4912   44.4912

Your first and second scxsc versions and mine yield identical results, so I
suppose there's something wrong in the applied math somewhere.

(file #49897)
_______________________________________________________

File name: scxsc.m                        Size:8 KB
<https://file.savannah.gnu.org/file/scxsc.m?file_id=49897>

_______________________________________________________

<https://savannah.gnu.org/patch/?9974>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

```