1. Products
  2.   3D
  3.   JavaScript
  4.   Open3D
 
  

Open Source JavaScript Library for 3D Geometry Processing

Open Source easy to use JavaScript 3D library allows to work with 3D geometries in node environment.

Open3D is a very simple and easy to use open source JavaScript 3D library that enables software developers to handle all complexities related to 3d geometry processing. The backend of the library is greatly optimized and is set up for parallelization. The main reason for the library creation is that there is no stable library for handling tasks related to 3d geometry in node environment. It is written in Typescript which fully supports native types for a project without the hassle of installing.

The Open3D current is a basic 3d library that currently encompasses functionalities of vectors / matrices / lines / planes / intersections. The Open3D is a lightweight library that helps with basic but bulky 3d calculations such as searching a closest point on a plane, interaction of two lines, calculate point to point distance, Transform a plane and find the normal of the transformed plane and son on. This library is available under the GPLv3 license which means it is free to use for personal and commercial projects.

Previous Next

Getting Started with Open3D

The easiest way to install Open3D stable release is using Yarn. Please use the following command for a smooth installation.

Install Open3D via Yarn

$yarn add open3d 

install Open3D via NPM using the following command.

npm i open3d 

You can download the compiled shared library from Github repository.

Transform a Plane in Various Ways via JavaScript API

A plane is a two dimensional surface that extends infinitely in 3D space and transformation is a process that changes the shape, size or position of a figure. The Free JavaScript 3D library, Open3D helps software developers to easily transform a plane inside their own JavaScript applications. It supports various functions for such as translate, rotate, scale and mirror a plane. It is also possible to combine transform and find the normal of the transformed plane. You can also create a rotation transformation that orients from plane1 to plane2.

Transform a Plane in Various Ways via JavaScript

Transform, Plane } from 'open3d';

// translation
const translate = Transform.Translation(new Vector3d(1, 2, 3));

// rotation
const rotation = Transform.Rotation(Math.PI / 3, new Vector3d(5, 2, 0), new Point3d(-2, 2, 9));

// scale
const scale = Transform.Scale(new Point3d(1, 2, 3), 3);

// mirror
const mirror = Transform.Mirror(new Plane(Point3d.Origin, new Vector3d(8, 2, -4), new Vector3d(0, 8, 5)));

// combine transform
const transformation = Transform.CombineTransforms([translate, rotation, scale, mirror]);

// transform plane
const plane = new Plane(Point3d.Origin, Vector3d.XAxis, Vector3d.YAxis);
const transformedPlane = plane.Transform(transformation);

Calculate Intersection of Two Lines via JavaScript

An intersection of two lines is a point where the graphs of two lines cross each other. The intersection of two or more lines plays a very important role in geometry. The Open source JavaScript Open3D Library fully supports to calculate the intersection of two lines with just a couple of lines of JavaScript code. To achieve the tasks first you need to define both the lines and then call the Intersection.LineLine() functions to complete the process of calculation.

How to Calculate Intersection to Two Lines via JavaScript Library

import { Line, Point3d, Intersection } from 'open3d';

const line1 = new Line(new Point3d(-4, -1, 0), new Point3d(5, 0, 0));

const line2 = new Line(new Point3d(0, -2, 0), new Point3d(3, 7, 0));

const intersection = Intersection.LineLine(line1, line2);

Manage 3D Vectors inside JavaScript Apps

A 3D vector is a line segment in three-dimensional space running from point A (tail) to point B (head). The Open source JavaScript Open3D Library has provided support for working with 3D vector inside JavaScript applications. You can easily Initializes a new instance of a vector, using its three components. It allows to Gets or sets X,Y or Z component of a vector with ease. It is also possible to Computes the length (or magnitude, or size) of this vector. It supports features like summing up two vectors, summing up a vector to a point, adding a point to this vector, subtracting vectors, multiplying a vector by a number and so on.

 English