GithubHelp home page GithubHelp logo

eurocat2k / ellipsoid Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 105 KB

Check if point (3D) is inside the ellipsoid - positioned, and rotated

JavaScript 100.00%
3d ellipsoid 3d-points matrix3d vector3d point3d axis-length rotation-matrix

ellipsoid's Introduction

Ellipsoid

Usage

Check if point (3D) is inside the ellipsoid - which is repositioned (translated) by its center, and rotated by roll,pitch,yaw angles.

obj = PointInOrientedEllipsoid(center, point, A, B, C, roll, pitch, yaw)
  • param center {Vector3D}

    default value: new Vector3D(0, 0, 0)

  • param point {Point3D}

    default value: new Point3D(0, 0, 0)

  • param A {Number} axis length

    default value: 0

  • param B {Number} axis length

    default value: 0

  • param C {Number} axis length

    default value: 0

  • roll (in degress)

    default value: 0

  • pitch (in degrees)

    default value: 0

  • yaw (in degrees)

    default value: 0

return {Object}

  • center: {Point3D} the center of the ellipsoid

  • point: {Point3D} the point checked if it is inside the ellipsoid

  • polar: {Object} the point's polar coordinates

    • distance: the distance between center and point

    • phi: degrees in range [-180..180]

    • theta: degrees in range [-90..90]

  • result: {Number} if this value >= 1, the point is not inside the ellipsoid

  • inside: {Boolean}

  • rMatrix: {Matrix3D} rotation matrix, just for debug

  • R: {Matrix3D} rotation matrix, just for debug

Example

let obj = PointInOrientedEllipsoid(new Vector3D(10,-20,30), new Point(9,-19,29), 9, 3, 3, 0, 0, 0);

console.log(obj);  // we expect the following result:
                   // {
                   //     bool: true,
                   //     center: { x: 10, y: -20, z: 30 },
                   //     point: { x: 9, y: -19, z: 29 },
                   //     polar: {
                   //         distance: 35.81898937714463,
                   //         phi: -32.03551940773309, 
                   //         theta: 72.75854060106003 
                   //     },
                   //     result: 0.2345679012345679,
                   //     inside: true,
                   //     rMatrix: {Object: Matrix3D},
                   //     R: {Object: Matrix3D}
                   // }

ellipsoid's People

Contributors

eurocat2k avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.