Skip to content

Instantly share code, notes, and snippets.

@cyrildiagne
Last active December 24, 2015 03:29
Show Gist options
  • Select an option

  • Save cyrildiagne/6738178 to your computer and use it in GitHub Desktop.

Select an option

Save cyrildiagne/6738178 to your computer and use it in GitHub Desktop.
isPointInsideBox
inline bool isPointInsideBox(const ofPoint &p, ofBoxPrimitive& c){
ofPoint tp = p - c.getPosition();
tp = tp * c.getGlobalTransformMatrix().getInverse().getRotate();
if (fabs(tp.x) > c.getWidth()*0.5
|| fabs(tp.y) > c.getHeight()*0.5
|| fabs(tp.z) > c.getDepth()*0.5){
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment