本文整理汇总了C#中Vertices.GetRadius方法的典型用法代码示例。如果您正苦于以下问题:C# Vertices.GetRadius方法的具体用法?C# Vertices.GetRadius怎么用?C# Vertices.GetRadius使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vertices
的用法示例。
在下文中一共展示了Vertices.GetRadius方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitOuterWall
private void InitOuterWall(Vertices vertices)
{
if (vertices.Count < 3)
{
Console.WriteLine("Too few vertices " + vertices.Count);
return;
}
Vertices drawingVertices = new Vertices(vertices);
float scale = _thickness / drawingVertices.GetRadius() + 1;
Vector2 scaleVector = new Vector2(scale);
Vector2 translation = drawingVertices.GetCentroid();
drawingVertices.Translate(-translation);
drawingVertices.Scale(ref scaleVector);
drawingVertices.Translate(translation);
_wallVerts = new VertexPositionTexture[vertices.Count * 2 + 2];
for (int i = 0; i < vertices.Count; ++i)
{
int j = i * 2;
_wallVerts[j].Position.X = vertices[i].X;
_wallVerts[j].Position.Y = vertices[i].Y;
_wallVerts[j].Position.Z = 0;
_wallVerts[j].TextureCoordinate = vertices[i] / _textureScaling;
_wallVerts[j + 1].Position.X = drawingVertices[i].X;
_wallVerts[j + 1].Position.Y = drawingVertices[i].Y;
_wallVerts[j + 1].Position.Z = 0;
_wallVerts[j + 1].TextureCoordinate = drawingVertices[i] / _textureScaling;
}
int lastIndex = vertices.Count * 2;
_wallVerts[lastIndex].Position.X = vertices[0].X;
_wallVerts[lastIndex].Position.Y = vertices[0].Y;
_wallVerts[lastIndex].Position.Z = 0;
_wallVerts[lastIndex].TextureCoordinate = vertices[0] / _textureScaling;
_wallVerts[lastIndex + 1].Position.X = drawingVertices[0].X;
_wallVerts[lastIndex + 1].Position.Y = drawingVertices[0].Y;
_wallVerts[lastIndex + 1].Position.Z = 0;
_wallVerts[lastIndex + 1].TextureCoordinate = drawingVertices[0] / _textureScaling;
}