Socket
Socket
Sign inDemoInstall

@datatypes/face

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datatypes/face

Class for 2-faces to use as facets of polyhedrons and polygon meshes


Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

Face

Class for 2-faces to use as facets of polyhedrons. Also called a "polygonal face".

Installation

npm install --save @datatypes/face

Usage

import Point from '@datatypes/point'
import Face from '@datatypes/face'

const vertices = [
	new Point(1, 0, 0),
	new Point(0, 1, 0),
	new Point(0, 0, 1)
]

const face = new Face(vertices)
	.calculateNormal()
	.calculateSurfaceArea()

console.log(face.toObject())

Output:

{
	vertices: [
		{x: 1, y: 0, z: 0},
		{x: 0, y: 1, z: 0},
		{x: 0, y: 0, z: 1}
	],
	normal: {
		x: 0.5773502691896258,
		y: 0.5773502691896258,
		z: 0.5773502691896258
	},
	surfaceArea: 0.8660254037844386
}

For a more detailed listing of available features check out the tests.

Keywords

FAQs

Package last updated on 07 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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