Skip to content

geo/intersection.c: fix intersection3 (may be optimization problem) #427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

YoheiKakiuchi
Copy link
Member

Why does the test pass on arm64 ( euslisp/jskeus#561 / https://travis-ci.org/github/euslisp/jskeus/builds/680614717 )

This is likely an optimization problem.
https://github.com/euslisp/EusLisp/blob/master/lisp/geo/intersection.c#L118

x86_64 (it's correct)

(setq l0 (make-line #f(-120.0 -30.0 0.0) #f(15.0 0.0 0.0)))
(setq l1 (make-line #f(-15.0 120.0 0.0)  #f(-15.0 0.0 0.0)))

(geo::line-intersection3 (l0 . pvert) (l0 . nvert) (l1 . pvert) (l1 . nvert) 0.00001) ;; -> (0.777778 1.05556)
(geo::line-intersection3 (l1 . pvert) (l1 . nvert) (l0 . pvert) (l0 . nvert) 0.00001) ;; -> (1.05556 0.777778)

arm64 (return same value)

(setq l0 (make-line #f(-120.0 -30.0 0.0) #f(15.0 0.0 0.0)))
(setq l1 (make-line #f(-15.0 120.0 0.0)  #f(-15.0 0.0 0.0)))

(geo::line-intersection3 (l0 . pvert) (l0 . nvert) (l1 . pvert) (l1 . nvert) 0.00001) ;; -> (1.05556 1.05556)
(geo::line-intersection3 (l1 . pvert) (l1 . nvert) (l0 . pvert) (l0 . nvert) 0.00001) ;; -> (0.777778 0.777778)

@k-okada
Copy link
Member

k-okada commented Apr 30, 2020 via email

@YoheiKakiuchi YoheiKakiuchi force-pushed the fix_intersection3_for_arm64 branch from 46a4ed0 to 9b87abf Compare May 1, 2020 07:24
@YoheiKakiuchi
Copy link
Member Author

Here is this PR and test-triangulation (euslisp/jskeus#561)
The tests should fail. (Tests using QEMU do not do test on jskeus)
https://travis-ci.org/github/YoheiKakiuchi/EusLisp/builds/682201965

Here is this PR and fix-triangulation (euslisp/jskeus#562)
All test passed.
https://travis-ci.org/github/YoheiKakiuchi/EusLisp/builds/682207533

@k-okada
Copy link
Member

k-okada commented May 26, 2020

Thanks for commit

  • added test code for intersection3 3d24d6e

  • I have confirmed that your patch fix this problem

    -  numunion nu;
    +  volatile numunion nu
    

    however, if we apply this chnage, we may have to cahnge all numunion variable. On the other hand, if we look into pointer LINEINTERSECTION(ctx,n,argv), this has

up=makeflt(u); vp=makeflt(v);
/* printf("%f %f\n",u,v); */
return(cons(ctx,up,cons(ctx,vp,NIL))); } }

closed via #432

@k-okada k-okada closed this May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants