Socket
Socket
Sign inDemoInstall

lore-engine

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lore-engine - npm Package Compare versions

Comparing version 1.0.38 to 1.0.39

0

.vscode/settings.json

@@ -0,0 +0,0 @@ {

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ [![view on npm](http://img.shields.io/npm/v/example.svg)](https://www.npmjs.org/package/example)

@@ -0,0 +0,0 @@ (function () {

@@ -0,0 +0,0 @@ (function () {

@@ -0,0 +0,0 @@ (function() {

@@ -0,0 +0,0 @@ (function() {

@@ -0,0 +0,0 @@ (function() {

@@ -0,0 +0,0 @@ var fs = require('fs');

@@ -0,0 +0,0 @@ {

4

package.json
{
"name": "lore-engine",
"version": "1.0.38",
"version": "1.0.39",
"description": "A WebGL based 3D data visualization engine.",

@@ -40,2 +40,2 @@ "main": "./app.js",

"private": false
}
}

@@ -0,0 +0,0 @@ ![Lore](https://github.com/reymond-group/lore/blob/master/logo.png?raw=true)

@@ -0,0 +0,0 @@ const CameraBase = require('./CameraBase');

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ const ControlsBase = require('./ControlsBase');

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ const Attribute = require('./Attribute');

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ const FilterBase = require('./FilterBase');

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ const AABBHelper = require('./AABBHelper');

//@ts-check
const HelperBase = require('./HelperBase');
const PointHelper = require('./PointHelper');
const Octree = require('../Spice/Octree');
const Raycaster = require('../Spice/Raycaster');
const DrawModes = require('../Core/DrawModes');
const Utils = require('../Utils/Utils');
const Vector3f = require('../Math/Vector3f');
const AABB = require('../Spice/AABB');
const Matrix4f = require('../Math/Matrix4f');
const FilterBase = require('../Filters/FilterBase');
const Ray = require('../Math/Ray')
const HelperBase = require("./HelperBase");
const PointHelper = require("./PointHelper");
const Octree = require("../Spice/Octree");
const Raycaster = require("../Spice/Raycaster");
const DrawModes = require("../Core/DrawModes");
const Utils = require("../Utils/Utils");
const Vector3f = require("../Math/Vector3f");
const AABB = require("../Spice/AABB");
const Matrix4f = require("../Math/Matrix4f");
const FilterBase = require("../Filters/FilterBase");
const Ray = require("../Math/Ray");
/**
* A helper class to create an octree associated with vertex data.
*
/**
* A helper class to create an octree associated with vertex data.
*
* @property {*} opts An object containing options.

@@ -27,6 +27,5 @@ * @property {PointHelper} target The Lore.PointHelper object from which this octree is constructed.

class OctreeHelper extends HelperBase {
/**
* Creates an instance of OctreeHelper.
*
*
* @param {Renderer} renderer A Lore.Renderer object.

@@ -44,3 +43,3 @@ * @param {String} geometryName The name of this geometry.

multiSelect: true
}
};

@@ -61,5 +60,8 @@ this.opts = Utils.extend(true, this.defaults, options);

this._clickHandler = function (e) {
if (e.e.mouse.state.middle || e.e.mouse.state.right ||
!that.target.geometry.isVisible) {
this._clickHandler = function(e) {
if (
e.e.mouse.state.middle ||
e.e.mouse.state.right ||
!that.target.geometry.isVisible
) {
return;

@@ -80,7 +82,10 @@ }

renderer.controls.addEventListener('click', this._clickHandler);
renderer.controls.addEventListener("click", this._clickHandler);
this._dblclickHandler = function (e) {
if (e.e.mouse.state.middle || e.e.mouse.state.right ||
!that.target.geometry.isVisible) {
this._dblclickHandler = function(e) {
if (
e.e.mouse.state.middle ||
e.e.mouse.state.right ||
!that.target.geometry.isVisible
) {
return;

@@ -101,7 +106,11 @@ }

renderer.controls.addEventListener('dblclick', this._dblclickHandler);
renderer.controls.addEventListener("dblclick", this._dblclickHandler);
this._mousemoveHandler = function (e) {
if (e.e.mouse.state.left || e.e.mouse.state.middle ||
e.e.mouse.state.right || !that.target.geometry.isVisible) {
this._mousemoveHandler = function(e) {
if (
e.e.mouse.state.left ||
e.e.mouse.state.middle ||
e.e.mouse.state.right ||
!that.target.geometry.isVisible
) {
return;

@@ -119,5 +128,8 @@ }

that.hovered = result[0];
that.hovered.screenPosition = that.renderer.camera.sceneToScreen(result[0].position, renderer);
that.hovered.screenPosition = that.renderer.camera.sceneToScreen(
result[0].position,
renderer
);
that.raiseEvent('hoveredchanged', {
that.raiseEvent("hoveredchanged", {
e: that.hovered

@@ -127,3 +139,3 @@ });

that.hovered = null;
that.raiseEvent('hoveredchanged', {
that.raiseEvent("hoveredchanged", {
e: null

@@ -134,5 +146,5 @@ });

renderer.controls.addEventListener('mousemove', this._mousemoveHandler);
renderer.controls.addEventListener("mousemove", this._mousemoveHandler);
this._updatedHandler = function () {
this._updatedHandler = function() {
if (!that.target.geometry.isVisible) {

@@ -143,13 +155,19 @@ return;

for (let i = 0; i < that.selected.length; i++) {
that.selected[i].screenPosition = that.renderer.camera.sceneToScreen(that.selected[i].position, renderer);
that.selected[i].screenPosition = that.renderer.camera.sceneToScreen(
that.selected[i].position,
renderer
);
}
if (that.hovered) {
that.hovered.screenPosition = that.renderer.camera.sceneToScreen(that.hovered.position, renderer);
that.hovered.screenPosition = that.renderer.camera.sceneToScreen(
that.hovered.position,
renderer
);
}
that.raiseEvent('updated');
that.raiseEvent("updated");
};
renderer.controls.addEventListener('updated', this._updatedHandler);
renderer.controls.addEventListener("updated", this._updatedHandler);

@@ -163,5 +181,5 @@ this.init();

init() {
if (this.opts.visualize === 'centers') {
if (this.opts.visualize === "centers") {
this.drawCenters();
} else if (this.opts.visualize === 'cubes') {
} else if (this.opts.visualize === "cubes") {
this.drawBoxes();

@@ -175,3 +193,3 @@ } else {

* Get the screen position of a vertex by its index.
*
*
* @param {Number} index The index of a vertex.

@@ -181,3 +199,3 @@ * @returns {Number[]} An array containing the screen position. E.g. [122, 290].

getScreenPosition(index) {
let positions = this.target.geometry.attributes['position'].data;
let positions = this.target.geometry.attributes["position"].data;
let k = index * 3;

@@ -191,3 +209,3 @@ let p = new Vector3f(positions[k], positions[k + 1], positions[k + 2]);

* Adds an object to the selected collection of this Lore.OctreeHelper object.
*
*
* @param {Object|Number} item Either an item (used internally) or the index of a vertex from the associated Lore.PointHelper object.

@@ -198,4 +216,4 @@ */

if (!isNaN(parseFloat(item))) {
let positions = this.target.geometry.attributes['position'].data;
let colors = this.target.geometry.attributes['color'].data;
let positions = this.target.geometry.attributes["position"].data;
let colors = this.target.geometry.attributes["color"].data;
let k = item * 3;

@@ -207,4 +225,9 @@

locCode: -1,
position: new Vector3f(positions[k], positions[k + 1], positions[k + 2]),
color: colors ? [colors[k], colors[k + 1], colors[k + 2]] : null
position: new Vector3f(
positions[k],
positions[k + 1],
positions[k + 2]
),
color: colors ? [colors[k], colors[k + 1], colors[k + 2]] : null,
timestamp: Date.now()
};

@@ -222,4 +245,7 @@ }

this.selected[index].screenPosition = this.renderer.camera.sceneToScreen(item.position, this.renderer);
this.raiseEvent('selectedchanged', {
this.selected[index].screenPosition = this.renderer.camera.sceneToScreen(
item.position,
this.renderer
);
this.raiseEvent("selectedchanged", {
e: this.selected

@@ -231,3 +257,3 @@ });

* Remove an item from the selected collection of this Lore.OctreeHelper object.
*
*
* @param {Number} index The index of the item in the selected collection.

@@ -238,3 +264,3 @@ */

this.raiseEvent('selectedchanged', {
this.raiseEvent("selectedchanged", {
e: this.selected

@@ -250,3 +276,3 @@ });

this.raiseEvent('selectedchanged', {
this.raiseEvent("selectedchanged", {
e: this.selected

@@ -258,3 +284,3 @@ });

* Check whether or not the selected collection of this Lore.OctreeHelper object contains a vertex with a given index.
*
*
* @param {Number} index The index of a vertex in the associated Lore.PointHelper object.

@@ -275,3 +301,3 @@ * @returns {Boolean} A boolean indicating whether or not the selected collection of this Lore.OctreeHelper contains a vertex with a given index.

* Adds a vertex with a given index to the currently hovered vertex of this Lore.OctreeHelper object.
*
*
* @param {Number} index The index of a vertex in the associated Lore.PointHelper object.

@@ -285,7 +311,7 @@ */

let k = index * 3;
let positions = this.target.geometry.attributes['position'].data;
let positions = this.target.geometry.attributes["position"].data;
let colors = null;
if ('color' in this.target.geometry.attributes) {
colors = this.target.geometry.attributes['color'].data;
if ("color" in this.target.geometry.attributes) {
colors = this.target.geometry.attributes["color"].data;
}

@@ -299,4 +325,7 @@

this.hovered.screenPosition = this.renderer.camera.sceneToScreen(this.hovered.position, this.renderer);
this.raiseEvent('hoveredchanged', {
this.hovered.screenPosition = this.renderer.camera.sceneToScreen(
this.hovered.position,
this.renderer
);
this.raiseEvent("hoveredchanged", {
e: this.hovered

@@ -307,3 +336,3 @@ });

/**
* Add the currently hovered vertex to the collection of selected vertices.
* Add the currently hovered vertex to the collection of selected vertices.
*/

@@ -325,6 +354,6 @@ selectHovered() {

/**
* Show the centers of the axis-aligned bounding boxes of this octree.
* Show the centers of the axis-aligned bounding boxes of this octree.
*/
showCenters() {
this.opts.visualize = 'centers';
this.opts.visualize = "centers";
this.drawCenters();

@@ -335,6 +364,6 @@ this.geometry.isVisible = true;

/**
* Show the axis-aligned boudning boxes of this octree as cubes.
* Show the axis-aligned boudning boxes of this octree as cubes.
*/
showCubes() {
this.opts.visualize = 'cubes';
this.opts.visualize = "cubes";
this.drawBoxes();

@@ -351,4 +380,4 @@ this.geometry.isVisible = true;

this.setAttribute('position', new Float32Array([]));
this.setAttribute('color', new Float32Array([]));
this.setAttribute("position", new Float32Array([]));
this.setAttribute("color", new Float32Array([]));
}

@@ -358,3 +387,3 @@

* Get the indices and distances of the vertices currently intersected by the ray sent from the mouse position.
*
*
* @param {Object} mouse A mouse object containing x and y properties.

@@ -369,4 +398,4 @@ * @returns {Object[]} A distance-sorted (ASC) array containing the interesected vertices.

result.sort(function (a, b) {
return a.distance - b.distance
result.sort(function(a, b) {
return a.distance - b.distance;
});

@@ -379,3 +408,3 @@

* Add an event listener to this Lore.OctreeHelper object.
*
*
* @param {String} eventName The name of the event to listen for.

@@ -394,3 +423,3 @@ * @param {Function} callback A callback function called when an event is fired.

* Raise an event with a given name and send the data to the functions listening for this event.
*
*
* @param {String} eventName The name of the event to be rised.

@@ -411,3 +440,3 @@ * @param {*} [data={}] Data to be sent to the listening functions.

* Adds a hoveredchanged event to multiple octrees and merges the event property e.
*
*
* @param {OctreeHelper[]} octreeHelpers An array of octree helpers to join.

@@ -418,3 +447,3 @@ * @param {Function} eventListener A event listener for hoveredchanged.

for (let i = 0; i < octreeHelpers.length; i++) {
octreeHelpers[i].addEventListener('hoveredchanged', function(e) {
octreeHelpers[i].addEventListener("hoveredchanged", function(e) {
let result = { e: null, source: null };

@@ -433,3 +462,3 @@ for (let j = 0; j < octreeHelpers.length; j++) {

* Adds a selectedchanged event to multiple octrees and merges the event property e.
*
*
* @param {OctreeHelper[]} octreeHelpers An array of octree helpers to join.

@@ -440,6 +469,12 @@ * @param {Function} eventListener A event listener for selectedchanged.

for (let i = 0; i < octreeHelpers.length; i++) {
octreeHelpers[i].addEventListener('selectedchanged', function(e) {
let result = []
octreeHelpers[i].addEventListener("selectedchanged", function(e) {
let result = [];
for (let j = 0; j < octreeHelpers.length; j++) {
result.push({ selected: octreeHelpers[j].selected, source: j });
for (let k = 0; k < octreeHelpers[j].selected.length; k++)
result.push({
timestamp: octreeHelpers[j].selected[k].timestamp,
item: octreeHelpers[j].selected[k],
index: k,
source: j
});
}

@@ -479,4 +514,4 @@ eventListener(result);

this.setAttribute('position', new Float32Array(positions));
this.setAttribute('color', new Float32Array(colors));
this.setAttribute("position", new Float32Array(positions));
this.setAttribute("color", new Float32Array(colors));
}

@@ -584,4 +619,4 @@

this.setAttribute('position', p);
this.setAttribute('color', c);
this.setAttribute("position", p);
this.setAttribute("color", c);
}

@@ -591,3 +626,3 @@

* Set the threshold of the raycaster associated with this Lore.OctreeHelper object.
*
*
* @param {Number} threshold The threshold (maximum distance to the ray) of the raycaster.

@@ -601,3 +636,3 @@ */

* Execute a ray intersection search within this octree.
*
*
* @param {Number[]} indices The indices of the octree nodes that are intersected by the ray.

@@ -611,7 +646,7 @@ * @returns {*} An array containing the vertices intersected by the ray.

let threshold = this.raycaster.threshold * this.target.getPointScale();
let positions = this.target.geometry.attributes['position'].data;
let positions = this.target.geometry.attributes["position"].data;
let colors = null;
if ('color' in this.target.geometry.attributes) {
colors = this.target.geometry.attributes['color'].data;
if ("color" in this.target.geometry.attributes) {
colors = this.target.geometry.attributes["color"].data;
}

@@ -639,3 +674,9 @@

let isVisible = FilterBase.isVisible(this.target.geometry, index);
if (dist < this.raycaster.near || dist > this.raycaster.far || dist < cutoff || !isVisible) continue;
if (
dist < this.raycaster.near ||
dist > this.raycaster.far ||
dist < cutoff ||
!isVisible
)
continue;

@@ -659,9 +700,15 @@ result.push({

destruct() {
this.renderer.controls.removeEventListener('click', this._dblclickHandler);
this.renderer.controls.removeEventListener('dblclick', this._dblclickHandler);
this.renderer.controls.removeEventListener('mousemove', this._mousemoveHandler);
this.renderer.controls.removeEventListener('updated', this._updatedHandler);
this.renderer.controls.removeEventListener("click", this._dblclickHandler);
this.renderer.controls.removeEventListener(
"dblclick",
this._dblclickHandler
);
this.renderer.controls.removeEventListener(
"mousemove",
this._mousemoveHandler
);
this.renderer.controls.removeEventListener("updated", this._updatedHandler);
}
}
module.exports = OctreeHelper
module.exports = OctreeHelper;

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ const CsvFileReader = require('./CsvFileReader');

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ const Core = require('./Core');

@@ -0,0 +0,0 @@ const Matrix3f = require('./Matrix3f');

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ const Shader = require('../Core/Shader')

@@ -0,0 +0,0 @@ const Shader = require('../Core/Shader')

@@ -0,0 +0,0 @@ const Shader = require('../Core/Shader')

@@ -0,0 +0,0 @@ const Shader = require('../Core/Shader')

@@ -0,0 +0,0 @@ const Shader = require('../Core/Shader')

@@ -0,0 +0,0 @@ const Shader = require('../Core/Shader')

@@ -0,0 +0,0 @@ var circle = require('./Circle');

@@ -0,0 +0,0 @@ const Shader = require('../Core/Shader')

@@ -0,0 +0,0 @@ const Shader = require('../Core/Shader')

@@ -0,0 +0,0 @@ const Shader = require('../Core/Shader')

@@ -0,0 +0,0 @@ const Shader = require('../Core/Shader')

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ const AABB = require('./AABB');

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ //@ts-check

@@ -0,0 +0,0 @@ const Utils = require('./Utils');

@@ -0,0 +0,0 @@ //@ts-check

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc