本文整理汇总了C#中Autodesk.get_Tangents方法的典型用法代码示例。如果您正苦于以下问题:C# Autodesk.get_Tangents方法的具体用法?C# Autodesk.get_Tangents怎么用?C# Autodesk.get_Tangents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Autodesk
的用法示例。
在下文中一共展示了Autodesk.get_Tangents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExtractSurface
public static Surface ExtractSurface(Autodesk.Revit.DB.HermiteFace face, IEnumerable<PolyCurve> edgeLoops)
{
// The number of interpolating points in the u direction is given by get_Params
var uParams = face.get_Params(0).Cast<double>().ToArray();
var vParams = face.get_Params(1).Cast<double>().ToArray();
var numU = uParams.Length;
var numV = vParams.Length;
// unpack the points
var points = face.Points;
// structure the points as 2d array - numU x numV
var ptArr = new Autodesk.DesignScript.Geometry.Point[numV][];
var count = 0;
for (var i = 0; i < numV; i++)
{
ptArr[i] = new Autodesk.DesignScript.Geometry.Point[numU];
for (var j = 0; j < numU; j++)
{
ptArr[i][j] = points[count++].ToPoint(false);
}
}
// unpack the tangents
var uTangents = face.get_Tangents(0);
var vTangents = face.get_Tangents(1);
// structure the tangents as 2d array - numU x numV
var uTangentsArr = new Vector[numV][];
var vTangentsArr = new Vector[numV][];
count = 0;
for (var i = 0; i < numV; i++)
{
uTangentsArr[i] = new Vector[numU];
vTangentsArr[i] = new Vector[numU];
for (var j = 0; j < numU; j++)
{
uTangentsArr[i][j] = uTangents[count].ToVector(false);
vTangentsArr[i][j] = vTangents[count].ToVector(false);
count++;
}
}
// u tangents run in increasing column direction
var uStartTangents = uTangentsArr.Select(x => x[0]).ToArray();
var uEndTangents = uTangentsArr.Select(x => x[numU - 1]).ToArray();
// v tangents run in increasing row direction
var vStartTangents = vTangentsArr[0];
var vEndTangents = vTangentsArr[numV-1];
// The mixed derivs are the twist vectors - dP / dUdV
var md = face.MixedDerivs;
Vector[] mds =
{
md[0].ToVector(false),
md[numU - 1].ToVector(false),
md[(md.Count - 1) - (numU-1)].ToVector(false),
md[md.Count - 1].ToVector(false)
};
return NurbsSurface.ByPointsTangentsKnotsDerivatives( ptArr,
uStartTangents,
uEndTangents,
vStartTangents,
vEndTangents,
HermiteToNurbs.Clamp(uParams),
HermiteToNurbs.Clamp(vParams),
mds);
}