本文整理汇总了C#中Geometry类的典型用法代码示例。如果您正苦于以下问题:C# Geometry类的具体用法?C# Geometry怎么用?C# Geometry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Geometry类属于命名空间,在下文中一共展示了Geometry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public virtual void Create(int x, int y, Geometry geometry, Tile[] sides)
{
geometry.CreateFace(x, 0, y, Geometry.Direction.east);
geometry.CreateFace(x, 0, y, Geometry.Direction.west);
geometry.CreateFace(x, 0, y, Geometry.Direction.up);
geometry.CreateFace(x, 0, y, Geometry.Direction.down);
}
示例2: Model
/// <summary>
/// Initializes a new instance of the <see cref="nginz.Model"/> class.
/// </summary>
/// <param name="geometry">Geometry.</param>
public Model(Geometry geometry)
{
Geometry = geometry;
Position = Vector3.Zero;
Scale = Vector3.One;
Rotation = Vector3.Zero;
}
示例3: GeographyContains
public GeographyContains(Geometry ContainingObject, Geometry ContainedObject)
{
this.ContainingObject = ContainingObject;
this.ContainingObjectType = ValueObjectType.Value;
this.ContainedObject = ContainedObject;
this.ContainedObjectType = ValueObjectType.Value;
}
示例4: SymDifference
public static Geometry SymDifference(Geometry g1, Geometry g2)
{
SqlGeometry sg1 = SqlGeometryConverter.ToSqlGeometry(g1);
SqlGeometry sg2 = SqlGeometryConverter.ToSqlGeometry(g2);
SqlGeometry sgSymDifference = sg1.STSymDifference(sg2);
return SqlGeometryConverter.ToSharpMapGeometry(sgSymDifference);
}
示例5: Intersection
public static Geometry Intersection(Geometry g1, Geometry g2)
{
SqlGeometry sg1 = SqlGeometryConverter.ToSqlGeometry(g1);
SqlGeometry sg2 = SqlGeometryConverter.ToSqlGeometry(g2);
SqlGeometry sgIntersection = sg1.STIntersection(sg2);
return SqlGeometryConverter.ToSharpMapGeometry(sgIntersection);
}
示例6: GeographyContains
public GeographyContains(Geometry outerValue, Geometry innerValue)
{
this.OuterValue = outerValue;
this.OuterValueType = ValueObjectType.Value;
this.InnerValue = innerValue;
this.InnerValueType = ValueObjectType.Value;
}
示例7: ParseGeometryLibrary_GeometryMesh
public void ParseGeometryLibrary_GeometryMesh(XmlNode MeshNode, Geometry CurrentGeometry)
{
Console.WriteLine("Entered MeshNode");
Mesh CurrentMesh = new Mesh();
for (int i = 0; i < MeshNode.ChildNodes.Count; i++)
{
if (MeshNode.ChildNodes[i].Name.Equals("source"))
{
ParseGeometryLibrary_GeometryMeshSource(MeshNode.ChildNodes[i], CurrentMesh);
}
if (MeshNode.ChildNodes[i].Name.Equals("vertices"))
{
ParseGeometryLibrary_GeometryMeshVertices(MeshNode.ChildNodes[i], CurrentMesh);
}
if (MeshNode.ChildNodes[i].Name.Equals("triangles"))
{
ParseGeometryLibrary_GeometryMeshTriangles(MeshNode.ChildNodes[i], CurrentMesh);
}
}
CurrentGeometry.mMeshes.Add(CurrentMesh);
}
示例8: RemoveVertex
public void RemoveVertex(Geometry.Point vertex)
{
int indexToRemove;
for (indexToRemove = 0; indexToRemove < _vertices.Count; ++indexToRemove)
{
if(_vertices[indexToRemove].Equals(vertex))
break;
}
if (indexToRemove == _vertices.Count)
return;
++_holeCount;
if (_vertices.Count == 1)
{
_vertices.RemoveAt(indexToRemove);
return;
}
if (_vertices.Count <= 2)
{
HandleVertexRemovalTwoPoint(indexToRemove);
return;
}
//TODO: Find new vertices that will emerge from removing the vertex
//TODO: preserve the cyclical ordering of the vertices to aid in area calculation.
}
示例9: Get
/// <summary>
/// Perform the 'get' operation.
/// </summary>
/// <param name="line"></param>
/// <returns></returns>
public Commands.Result Get(out Geometry.Line line)
{
IntPtr ptr_this = NonConstPointer();
line = Geometry.Line.Unset;
int rc = UnsafeNativeMethods.RHC_RhinoGetLine2(ptr_this, ref line, IntPtr.Zero);
return (Commands.Result)rc;
}
示例10: SlicePolygon
/// <summary>
/// Slices a polygon by a circle with some thickness.
/// Input circle may be a line.
/// </summary>
/// <remarks>The input polygon might get reversed</remarks>
public static void SlicePolygon( Polygon p, CircleNE c, Geometry g, double thickness, out List<Polygon> output )
{
output = new List<Polygon>();
// Setup the two slicing circles.
CircleNE c1 = c.Clone(), c2 = c.Clone();
Mobius m = new Mobius();
Vector3D pointOnCircle = c.IsLine ? c.P1 : c.Center + new Vector3D( c.Radius, 0 );
m.Hyperbolic2( g, c1.CenterNE, pointOnCircle, thickness / 2 );
c1.Transform( m );
m.Hyperbolic2( g, c2.CenterNE, pointOnCircle, -thickness / 2 );
c2.Transform( m );
// ZZZ - alter Clip method to work on Polygons and use that.
// Slice it up.
List<Polygon> sliced1, sliced2;
Slicer.SlicePolygon( p, c1, out sliced1 );
Slicer.SlicePolygon( p, c2, out sliced2 );
// Keep the ones we want.
foreach( Polygon newPoly in sliced1 )
{
bool outside = !c1.IsPointInsideNE( newPoly.CentroidApprox );
if( outside )
output.Add( newPoly );
}
foreach( Polygon newPoly in sliced2 )
{
bool inside = c2.IsPointInsideNE( newPoly.CentroidApprox );
if( inside )
output.Add( newPoly );
}
}
示例11: WallCollision
private static bool WallCollision(Geometry.Circle2D c, double objectZ, double objectHeight, Wall wall)
{
if (Geometry.Intersections.CirclePolygonIntersection(c,
wall.Area))
return true;
return false;
}
示例12: DoGeodesicLength
private async Task DoGeodesicLength()
{
ResetButton.IsEnabled = false;
try
{
if (mapView1.Editor.IsActive)
mapView1.Editor.Cancel.Execute(null);
//Get the input polygon geometry from the user
inputGeom = await mapView1.Editor.RequestShapeAsync(DrawShape.Polyline);
if (inputGeom != null)
{
//Add the polygon drawn by the user
var g = new Graphic
{
Geometry = inputGeom,
};
myGraphicsLayer.Graphics.Add(g);
//Get the label point for the input geometry
var length = GeometryEngine.GeodesicLength(inputGeom);
LineLengthTextBlock.Text = length.ToString("N2") + " m";
LineLengthTextBlock.Visibility = Windows.UI.Xaml.Visibility.Visible;
}
}
catch (Exception)
{
}
ResetButton.IsEnabled = true;
}
示例13: NativeGeometryNonConstPointer
/// <summary>
/// Returns the underlying non-const ON_Geometry* for a RhinoCommon class. You should
/// only be interested in using this function if you are writing C++ code.
/// </summary>
/// <param name="geometry">A geometry object. This can be null and in such a case <see cref="IntPtr.Zero"/> is returned.</param>
/// <returns>A pointer to the non-const geometry.</returns>
public static IntPtr NativeGeometryNonConstPointer(Geometry.GeometryBase geometry)
{
IntPtr rc = IntPtr.Zero;
if (geometry != null)
rc = geometry.NonConstPointer();
return rc;
}
示例14: Model
/// <summary>
/// Creates a new empty model.
/// </summary>
public Model(Matrix transform)
{
Enabled = true;
this.transform = transform;
inverseTranspose = Matrix.InverseTranspose(transform);
geometry = new Geometry(SceneFlags.Static | SceneFlags.HighQuality, TraversalFlags.Single | TraversalFlags.Packet4);
}
示例15: Geometry
/// <summary>
/// 拷贝构造函数。
/// </summary>
/// <param name="geometry">几何对象。</param>
/// <exception cref="ArgumentNullException">几何对象为 null 时抛出异常。</exception>
public Geometry(Geometry geometry)
{
if (geometry == null) throw new ArgumentNullException();
this.Id = geometry.Id;
if (geometry.Parts != null)
{
int length = geometry.Parts.Length;
this.Parts = new int[length];
for (int i = 0; i < length; i++)
{
this.Parts[i] = geometry.Parts[i];
}
}
if (geometry.Points != null)
{
int length = geometry.Points.Length;
this.Points = new Point2D[length];
for (int i = 0; i < length; i++)
{
this.Points[i] = new Point2D(geometry.Points[i]);
}
}
if (Style != null)
{
this.Style = new Style(geometry.Style);
}
this.Type = geometry.Type;
}