本文整理汇总了C#中Scientrace.tryToUnitVector方法的典型用法代码示例。如果您正苦于以下问题:C# Scientrace.tryToUnitVector方法的具体用法?C# Scientrace.tryToUnitVector怎么用?C# Scientrace.tryToUnitVector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scientrace
的用法示例。
在下文中一共展示了Scientrace.tryToUnitVector方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CircularPrism
//length inherited from Prism
public CircularPrism(Scientrace.Object3dCollection parent, Scientrace.MaterialProperties mprops, Scientrace.Location loc, Scientrace.NonzeroVector width, Scientrace.NonzeroVector height, Scientrace.NonzeroVector length)
: base(parent, mprops)
{
this.loc = loc;
this.width = width;
this.height = (height.tryToUnitVector())*width.length;
this.length = length;
}
示例2: angleOnSurface
public double angleOnSurface(Scientrace.Vector aVector)
{
return this.angleOnSurface(aVector.tryToUnitVector());
}
示例3: x3dRotationTransform
public string x3dRotationTransform(Scientrace.Vector orivec)
{
//the Circle2D objects will normally be drawn in the x,y plane (perpendicular to 0,0,1) so it has to
//rotated out of that plane as follows.
Scientrace.UnitVector oriunivec = orivec.tryToUnitVector();
Scientrace.UnitVector uxv = (this.u.crossProduct(this.v).tryToUnitVector());
if (uxv == oriunivec) {
return "<Transform rotation='0 0 0 0'>";
// throw new ArithmeticException("Plane vectors uxv ("+uxv.trico()+") & oriunivec ("+oriunivec.trico()+") are equal");
}
try {
Scientrace.UnitVector rotaxis = (oriunivec).crossProduct(uxv).tryToUnitVector();
return "<Transform rotation='"+rotaxis.trico()+" "+(oriunivec.angleWith(rotaxis)).ToString()+"'>";
} catch // possible error: zerovector after cross product (rounding error at first comparison), return zero rotation tag.
{ return "<Transform rotation='0 0 0 0'>"; }
}