docs/api_AbstractModule.js.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: api/AbstractModule.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: api/AbstractModule.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>const AbstractParent = require('./AbstractParent');
function isCoordinateWithinBounds(coordinate, min, max) {
return coordinate >= min && coordinate <= max;
}
module.exports = class extends AbstractParent {
constructor(options, file) {
super(options, file);
}
/**
* @typedef {object} BoundingBox A box in 2D/3D space.
* @property {Vertex} min A 2D/3D vertex which defines the 'minimum' co-ordinates. This is the corner of the box with the lowest x, y and optional z co-ordinate.
* @property {Vertex} max A 2D/3D vertex which defines the 'maximum' co-ordinates. This is the corner of the box with the highest x, y and optional z co-ordinate.
*/
isWithinBoundingBox(boundingBox) {
const failingVertices = this.vertices.reduce((failingCounter, vertex) => {
return failingCounter + vertex.reduce((accumulator, coordinate, index) => {
return isCoordinateWithinBounds(coordinate, boundingBox.min[index], boundingBox.max[index]) ? accumulator : accumulator + 1;
}, 0);
}, 0);
return failingVertices === 0;
}
};</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Function.html">Function</a></li><li><a href="ThreeDModule.html">ThreeDModule</a></li><li><a href="TwoDModule.html">TwoDModule</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>