← Back

ofxRay

github.com/elliotwoods/ofxRay · @elliotwoods
OF 0.11 Graphics

Lightweight Ray class and operations for openFrameworks (e.g. hit detection, intersection). For more intense use check bullet physics

69 19 Last commit 5y ago Created 15y ago

Branches ahead of master

These branches have commits not yet on master — could be unmerged fixes or work in progress worth a look.

glm 1 commit ahead · last commit 9y ago
jordi 3 commits ahead · last commit 12y ago
static-lib 3 commits ahead · last commit 14y ago
mappingdev 4 commits ahead · last commit 14y ago

README

ofxRay



Introduction



A lightweight set of tools for intersection testings (e.g. does a ray intersect a plane).

Note



The current code in this repository is designed for openFrameworks 0.10.0. If you are looking for a version of ofxRay which is compatible with previous versions of openFrameworks, please check https://github.com/elliotwoods/ofxRay/tree/0.9.8 .

Objects



ofxRay::Ray



A _Ray_ is defined by the starting point s and the transmission vector t . Check equation (5) at http://mathworld.wolfram.com/Line.html

We define a ray as an infinite line (continuing infinitely forwards and backwards along the line t and - t starting at s .

The line is defined by points s + u t , where {-inf < _u_ < +inf}.

A _Line segment_ is a line which has finite length. We denote a line segment as a ofRay between s and t where infinite is set to _false_ , i.e. a _Line segment_ is a finite section along a ray

ofxRay::Plane



A _Plane_ is defined by a position on the plane c and a normal vector n .

We can also define the plane using the notation _a_ x + _b_ y + _c_ z + _d_ = 0 (by using the appropriate constructor).

For a non-infinite plane, we define the bounds of the _Plane segment_ with the 2D vector bounds, and the up vector up. We presume that the up vector and n vectors are perpendicular.

ofxRay::Projector



A _Projector_ is defined by projection matrix and its pose (defined by ofNode which it inherits from).

We can use a projector to preview a projector or camera in a scene, and to generate pixel _ofRay_s.

ofxRay::Camera



A _Camera_ is defined the same as a _Projector_, but has distortion coefficients also.

ofxRay::Base



All objects within ofxRay inherit from ofxRay::Base.

Authors



Elliot Woods (main author)

Get this addon

HTTPS
SSH