本文整理汇总了C#中Vector.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Vector.Select方法的具体用法?C# Vector.Select怎么用?C# Vector.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector
的用法示例。
在下文中一共展示了Vector.Select方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToString
private static string ToString(Vector vector)
{
return string.Join(",", vector.Select(item => Math.Round(item, 2)));
}
示例2: TypeCheck
private Vector<Class> TypeCheck(Vector<Class> classes, Scope scope)
{
return classes.Select(x => TypeCheck(x, scope)).ToVector();
}
示例3: ProbRain
/// <summary>
/// Returns the probability of Rain given optional readings on
/// cloudiness, sprinkler, and wetness of grass, and given known parameters.
/// </summary>
/// <param name="cloudy">Optional observation of cloudy or not</param>
/// <param name="sprinkler">Optional observation of whether sprinkler is on or not</param>
/// <param name="wet">Optional observation or whether grass is wet or not</param>
/// <param name="probCloudyPrior">Cloudiness probability vector</param>
/// <param name="cptSprinklerPrior">Sprinkler conditional probability table</param>
/// <param name="cptRainPrior">Rain conditional probability table</param>
/// <param name="cptWetGrassPrior">Wet grass conditional probability table</param>
/// <returns>Probability that it has rained</returns>
public double ProbRain(
int? cloudy,
int? sprinkler,
int? wet,
Vector probCloudy,
Vector[] cptSprinkler,
Vector[] cptRain,
Vector[][] cptWetGrass)
{
var probCloudyPrior = Dirichlet.PointMass(probCloudy);
var cptSprinklerPrior = cptSprinkler.Select(v => Dirichlet.PointMass(v)).ToArray();
var cptRainPrior = cptRain.Select(v => Dirichlet.PointMass(v)).ToArray();
var cptWetGrassPrior = cptWetGrass.Select(va => va.Select(v => Dirichlet.PointMass(v)).ToArray()).ToArray();
return ProbRain(cloudy, sprinkler, wet, probCloudyPrior, cptSprinklerPrior, cptRainPrior, cptWetGrassPrior);
}
示例4: 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);
}