项目作者: nglthu

项目描述 :
Graphics and Modelling by using OpenGL, WebGL APIs
高级语言: HTML
项目地址: git://github.com/nglthu/Graphics.git
创建时间: 2017-11-22T14:30:54Z
项目社区:https://github.com/nglthu/Graphics

开源协议:GNU General Public License v3.0

下载


Graphics

see printable documentation

Introduction

Mesh

A collection of lines segments forming a close loop is called a polygon.
A collection of one or more polygons that formed of vertices and grouped together is called mesh.

Example of a mesh:

A simple cube has 8 vertices, and formed of six polygons:

  1. Figure 1: A cube formed form six polygons (each polygon formed from a close loop four-lines).

A simple 3D triangle has 4 vertices, and formed of four polygons.

  1. Figure 2: 3D triangle form of four polygons (each polygon form from a close loop three-lines)

Combination of polygons on one frame

  1. Figure 3: Methane with combination of sphere, four atoms, and four cylinders

Modelling by using graphics API (OpenGL, WebGL) :

WebGL/Three.js code that defines a vertex

WebGL considers these vertices to be a part of polygons such as a triangle using the faces.push method. Produce a polygon with 3 or 4 edges, we would need to create a THREE.Face3 or THREE.Face4 respectively

The collection of one or more Polygons (mesh) that formed of vertices and grouped together that coordinate position of each vertex has to be calculated.

The mesh could be changed, or rotate based its size requires that the coordinate position of each vertex has to be recalculated.

Implementation :

Mesh with sphere geometry : Access Link of sphere

Polygon Square composed of 4 vertices: Access Link of Square polygon

Polygon Triangle: Access Link of Triangle Polygon

Polygon Sphere with bouncing : Access Link of Sphere with bouncing

Methane Modecule : Access link of Methane