Two pits of the GJK

Source: Internet
Author: User

①: If two graphs are in contact, then the EPA will get an embedding vector of 0 vectors. As long as the original point just on the Minkowski boundary of the situation also ruled out as a non-contact can be solved.

②: If the origin falls exactly on the simplex ab edge, then the search direction will be 0 vectors, and the resulting simplex is no longer a triangle, but a line segment. At this point only to determine whether overlapping GJK can still be judged normally, but then the EPA will not work properly. The personal solution is to forcibly use AB's vertical vector as the search direction to find a point C to form a triangle. The subsequent EPA may have a slightly biased embedding vector, but it is still within the accepted range.

Isintersect:function () {var dir = new Pngx.                VECTOR2D (1, 1), Simplexa, Simplexb, Simplexc;                Simplexa = This.getsupportpoint (dir);                if (Simplexa.dot (dir) <= 0) {return false;                dir = Simplexa.negate ();                Simplexb = This.getsupportpoint (dir);                if (Simplexb.dot (dir) <= 0) {return false;                } var ab = Simplexb.sub (simplexa); dir = Pngx.                Vector2d.tripleproduct (AB, Simplexa.negate (), AB); for (var i = this.maxiterations; i--;)                        {if (Dir.iszero ()) {this._simplexa = Simplexa;                        This._simplexb = Simplexb;                        dir = simplexb.sub (simplexa). Vertical (); This._simplexc = This.getsupportpoint (dir); The origin is exactly on the AB to make the search direction is 0 vectors, forcibly select a perpendicular to the direction of AB to find SimplThe 3rd return of ex is true;                    } Simplexc = This.getsupportpoint (dir);                    if (Simplexc.dot (dir) <= 0) {//less than sign to less than equals, the origin is exactly on the boundary and also excludes return false;                        } var ba = Simplexa.sub (SIMPLEXB), ac = Simplexc.sub (Simplexa), BC = Simplexc.sub (SIMPLEXB), Acperp = Pngx. Vector2d.tripleproduct (AC, Ba.negate (), ac), Bcperp = Pngx.                    Vector2d.tripleproduct (BC, BA, BC);                        if (Acperp.dot (Simplexa) > 0) {simplexb = Simplexc;                    dir = Acperp.negate ();                        } else if (Bcperp.dot (SIMPLEXB) > 0) {simplexa = Simplexc;                    dir = Bcperp.negate ();                        } else {this._simplexa = Simplexa;         This._simplexb = Simplexb;               This._simplexc = Simplexc;                    return true;            }} return false; }

  

Two pits of the GJK

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.