codecamp

three.js ShapeUtils

一个包含形状实用函数的类。

请注意,这些都是线性函数,因此有必要分别计算向量的x,y(和z,w,如果存在的话)分量。

方法

.area ( contour ) : Number

contour -- 2D多边形,一个THREE.Vector2()数组。计算(2D)轮廓多边形的面积。

.isClockWise ( pts ) : Boolean

pts -- 定义2D多边形的点请注意,这是一个线性函数,因此需要分别计算多边形的x,y分量。由Path,ExtrudeGeometry和ShapeGeometry内部使用。

.triangulateShape ( contour, holes ) : Array

contour -- 2D多边形。holes -- 孔洞数组由ExtrudeGeometry和ShapeGeometry内部使用以计算带孔的形状中的面。

源代码

src/extras/ShapeUtils.js


three.js PMREMGenerator
three.js Curve
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

参考

核心 / BufferAttributes

渲染器 / WebXR

开发者参考

WebGL渲染器

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }