new FdLoft(viewer, id)
Parameters:
| Name | Type | Description |
|---|---|---|
viewer |
Freedo.Viewer | |
id |
string | |
opt.positions |
Array.<Freedo.Cartesian3> | 路线关键点,没有指定时启用手动选点 |
opt.shapeType |
string | 截面形状,目前支持['circle'|'semicircle'|'triangle'|'pentagram'|'square'|'panel'], 圆形、半圆、三角形、五角星、正方形、面 |
opt.shape |
Array.<Freedo.Cartesian3> | 截面特征点,如果指定了截面形状则会忽略这个参数 |
opt.thick |
number | 管道厚度 |
opt.color |
Freedo.Color | 管道颜色,如果指定了纹理图片则颜色设置无效,默认Freedo.Color.YELLOW |
opt.image |
string | 管道纹理图片路径 |
opt.loop |
boolean | number | 纹理循环播放频率,默认为false |
opt.rate |
number | 管道转弯时插值的密度,默认720 |
opt.smooth |
number | 管道转弯半径系数,默认1.5,转弯半径为管道总宽度一半乘以该系数 |
opt.showDebugWireframe |
number | 是否显示线框结构 |
opt.offsetHeight |
number | 手动绘制时的偏移高度,默认为0.1 |
Example
var viewer = Freedo.FdApp.createDefaultViewer('freedoContainer');
//如果option参数中不包含pts属性,则会激活手动选取节点的功能
var ent = mm.add('Loft', {
positions: [
new Freedo.Cartesian3(0.0, 0.0, 0.0),
new Freedo.Cartesian3(100.0, 0.0, 0.0)
],
smooth: 50,
shape: [
new Freedo.Cartesian3(0, 0, 0),
new Freedo.Cartesian3(1, 0, 0),
new Freedo.Cartesian3(1, 1, 0),
new Freedo.Cartesian3(0, 1, 0)
]
});
Members
-
option
-
获取实体的属性数据
Methods
-
<static> buildCirclePts(center, radii, vec, rate)
-
生成一个圆的特征点坐标数组
Parameters:
Name Type Description centerFreedo.Cartesian3 圆的中心点
radiinumber 半径
vecFreedo.Cartesian3 圆的轴方向向量
ratenumber 圆上点的插值密度,默认360
-
<static> buildGeometry(opt)
-
根据参数生成Geometry
Parameters:
Name Type Description optObject 构建Geometry所需参数
Properties
Name Type Description positionsnumber 顶点集合
normalsnumber 三角面法向量集合
compressStboolean 是否压缩纹理坐标,默认true 特别说明:除非明确知道纹理坐标计算过程和primitive的关系,否则不要设置这个属性
primitiveTypeFreedo.PrimitiveType 顶点构建primitive类型
-
<static> buildPentagramPts(center, radii, vec)
-
构建一个五角星坐标
Parameters:
Name Type Description center* 五角星中心
radii* 最大半径
vec* 五角星所在面的法向量
-
<static> buildPrimitive(shapes)
-
根据截面特征点生成Primitive
Parameters:
Name Type Description shapesArray.<Array.<Freedo.Cartesian3>> 所有截面集合特征点
Returns:
根据特征点集合生成的Primitive
- Type
- Freedo.Primitive
-
<static> calcInner(shape, pt, thick)
-
根据外径点计算内径点
Parameters:
Name Type Description shapeArray.<Freedo.Cartesian3> 截面外径特征点
ptFreedo.Cartesian3 截面中心点
thicknumber 厚度
-
<static> drawShape(pos, shape, pt, vt, r, thick)
-
计算转弯时其中一个截面特征点
Parameters:
Name Type Description posFreedo.Cartesian3 中心点起始位置(即shape参数指定截面的中心点)
shapeArray.<Freedo.Cartesian3> 截面关键点
ptFreedo.Cartesian3 要计算的截面中心点位置
vtFreedo.Cartesian3 截面旋转的轴向量
rnumber 截面旋转的弧度数
thicknumber 管道厚度
Returns:
截面特征点
- Type
- Array.<Freedo.Cartesian3>
-
<static> getMaxRdii(pt, shape)
-
计算到截面中心的最大距离
Parameters:
Name Type Description ptFreedo.Cartesian3 截面中心点
shapeArray.<Freedo.Cartesian3> 截面特征点
-
<static> getSoomth()
-
动态计算转弯半径
-
<static> rotateVector(vc, v, r, rlt)
-
旋转向量指定的弧度
Parameters:
Name Type Description vcFreedo.Cartesian3 旋转的轴
vFreedo.Cartesian3 要旋转的向量
rnumber 旋转的弧度
rltFreedo.Cartesian3 旋转后的向量
-
<static> showWireframe()
-
显示关键点线框
-
<static> smoothBrokenline(pts, shape, rate, smooth)
-
计算一段转弯折线(三个点)的插值截面集合
Parameters:
Name Type Description pts* 折线的三个点
shape* 截面在折线第一个点时的特征点
rate* 转弯插值密度
smooth* 转弯半径相对于截面最大半径倍数(截面为点时为转弯半径(米))
-
<static> smoothByPolyline(pts, shape, rate, smooth)
-
Parameters:
Name Type Description ptsArray.<Freedo.Cartesian3> 路径关键点集合
shapeArray.<Freedo.Cartesian3> 截面关键点
ratenumber 拐点插值密度默认720,即每0.5度插值一个点
smoothnumber 转弯半径大小(截面最大半径倍数)
-
<static> stCalculator(shape, pts, ratio)
-
纹理坐标计算器
Parameters:
Name Type Description shapeArray.<Freedo.Cartesian3> 第一个截面特征点
pts* 插值之后的截面中心点
ratio* 图片的宽高比
-
<static> triangulate(shapes, ratio)
-
将截面特征点三角化生成顶点集合、索引集合、法向量集合。。。
Parameters:
Name Type Description shapesArray.<Array.<Freedo.Cartesian3>> 截面特征点集合
ratioNumber 纹理长宽比
-
destroy()
-
销毁
-
hide()
-
隐藏
-
on(listener [, scope])
-
注册事件捕捉
Parameters:
Name Type Argument Description listenerFdModel.FdModelManager~FdModelManagerCallback 当有事件触发时被执行的函数。
scopeObject <optional>
listener函数执行时的绑定的对象。
Returns:
返回一个函数,调用该函数可以取消监听。
- Type
- Freedo.Event~RemoveCallback
-
remove()
-
移除(销毁)
-
show()
-
显示