New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@viewar/guide

Package Overview
Dependencies
Maintainers
8
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@viewar/guide - npm Package Compare versions

Comparing version 0.10.1 to 0.11.0

2

package.json
{
"name": "@viewar/guide",
"version": "0.10.1",
"version": "0.11.0",
"description": "ViewAR Guide",

@@ -5,0 +5,0 @@ "main": "dist/viewar-guide.js",

@@ -8,2 +8,3 @@ import Vector3 from '../../math/vector3'

import { NO_WAYPOINT } from '../../constants';
import { projectPointOnEdge } from '../../math/math'

@@ -53,2 +54,8 @@ export default ({ body, navigation, getGuideParams }) => {

const normalizeYPosition = ({x, y, z}) => ({
x,
y: 0,
z,
});
/**

@@ -62,9 +69,19 @@ * Get height on line between previous waypoint and current waypoint.

if (previous !== NO_WAYPOINT && current !== NO_WAYPOINT) {
const distance = position.clone().subtract(previous.pose.position).length();
const orientation = getQuaternionFromVectors(current.pose.position, previous.pose.position);
const { bank } = orientation.toEulerAngles();
const height = Math.tan(bank) * distance;
return height;
let guidePosition = projectPointOnEdge(normalizeYPosition(position), [normalizeYPosition(current.pose.position), normalizeYPosition(previous.pose.position)]);
if (guidePosition) {
// Linear interpolation between previous and current waypoint.
const currentPosition = new Vector3(current.pose.position);
const previousPosition = new Vector3(previous.pose.position);
const totalDistance = currentPosition.clone().subtract(previousPosition).length();
const distance = guidePosition.clone().subtract(previousPosition).length();
const heightDiff = currentPosition.y - previousPosition.y;
const height = previousPosition.y + heightDiff / totalDistance * distance;
return height;
}
}
// Return zero height for first waypoint or if guidePosition can't be projected onto the path.
return 0

@@ -71,0 +88,0 @@ }

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

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