当前位置: 首页>>代码示例>>C#>>正文


C# Vertex.Select方法代码示例

本文整理汇总了C#中Vertex.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Vertex.Select方法的具体用法?C# Vertex.Select怎么用?C# Vertex.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vertex的用法示例。


在下文中一共展示了Vertex.Select方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FindReachableTypes

        /// <summary>
        ///     Determines which types are produced by this mapping.
        /// </summary>
        private Set<EntityType> FindReachableTypes(
            DomainConstraintConversionContext<string, ValueCondition> converter, Vertex[] mappingConditions)
        {
            // For each entity type, create a candidate function that evaluates to true given
            // discriminator assignments iff. all of that type's conditions evaluate to true
            // and its negative conditions evaluate to false.
            var candidateFunctions = new Vertex[MappedEntityTypes.Count];
            for (var i = 0; i < candidateFunctions.Length; i++)
            {
                // Seed the candidate function conjunction with 'true'.
                var candidateFunction = Vertex.One;
                for (var j = 0; j < NormalizedEntityTypeMappings.Count; j++)
                {
                    var entityTypeMapping = NormalizedEntityTypeMappings[j];

                    // Determine if this mapping is a positive or negative case for the current type.
                    if (entityTypeMapping.ImpliedEntityTypes[i])
                    {
                        candidateFunction = converter.Solver.And(candidateFunction, mappingConditions[j]);
                    }
                    else
                    {
                        candidateFunction = converter.Solver.And(candidateFunction, converter.Solver.Not(mappingConditions[j]));
                    }
                }
                candidateFunctions[i] = candidateFunction;
            }

            // Make sure that for each type there is an assignment that resolves to only that type.
            var reachableTypes = new Set<EntityType>();
            for (var i = 0; i < candidateFunctions.Length; i++)
            {
                // Create a function that evaluates to true iff. the current candidate function is true
                // and every other candidate function is false.
                var isExactlyThisTypeCondition = converter.Solver.And(
                    candidateFunctions.Select(
                        (typeCondition, ordinal) => ordinal == i
                                                        ? typeCondition
                                                        : converter.Solver.Not(typeCondition)));

                // If the above conjunction is satisfiable, it means some row configuration exists producing the type.
                if (!isExactlyThisTypeCondition.IsZero())
                {
                    reachableTypes.Add(MappedEntityTypes[i]);
                }
            }

            return reachableTypes;
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:52,代码来源:FunctionImportStructuralTypeMappingKB.cs

示例2: RunDepthFirstSearch

 private static bool[] RunDepthFirstSearch(Vertex[] vertices, int source)
 {
     DepthFirstSearch.Run(vertices[source]);
     return vertices.Select(v => v.Color == Color.Black).ToArray();
 }
开发者ID:mmoroney,项目名称:Algorithms,代码行数:5,代码来源:DepthFirstSearchTest.cs

示例3: RunDjikstra

 private static bool[] RunDjikstra(Vertex[] vertices, int source)
 {
     Djikstra.Run(vertices[source]);
     return vertices.Select(v => v.Depth != int.MaxValue).ToArray();
 }
开发者ID:mmoroney,项目名称:Algorithms,代码行数:5,代码来源:DepthFirstSearchTest.cs

示例4: RunBellmanFord

 private static bool[] RunBellmanFord(Vertex[] vertices, int source)
 {
     BellmanFord.Run(vertices, source);
     return vertices.Select(v => v.Depth != int.MaxValue).ToArray();
 }
开发者ID:mmoroney,项目名称:Algorithms,代码行数:5,代码来源:DepthFirstSearchTest.cs

示例5: RunDjikstra

 private static int[] RunDjikstra(Vertex[] vertices, int source)
 {
     Djikstra.Run(vertices[source]);
     return vertices.Select(v => v.Depth).ToArray();
 }
开发者ID:mmoroney,项目名称:Algorithms,代码行数:5,代码来源:BreadthFirstSearchTest.cs

示例6: RunBreadthFirstSearch

 private static int[] RunBreadthFirstSearch(Vertex[] vertices, int source)
 {
     BreadthFirstSearch.Run(vertices[source]);
     return vertices.Select(v => v.Depth).ToArray();
 }
开发者ID:mmoroney,项目名称:Algorithms,代码行数:5,代码来源:BreadthFirstSearchTest.cs

示例7: RunBellmanFord

 private static int[] RunBellmanFord(Vertex[] vertices, int source)
 {
     BellmanFord.Run(vertices, source);
     return vertices.Select(v => v.Depth).ToArray();
 }
开发者ID:mmoroney,项目名称:Algorithms,代码行数:5,代码来源:BreadthFirstSearchTest.cs

示例8: OgreXmlWriter

 public OgreXmlWriter(Vertex[] vertices, Triangle[] triangles, string uri)
 {
     // Look, ma, no semicolons!
     var mesh = new XElement("mesh",
         new XElement("submeshes",
             new XElement("submesh",
                 new XAttribute("material","BaseWhite"),
                 new XAttribute("usesharedvertices","false"),
                 new XElement("faces",
                     new XAttribute("count", triangles.Length.ToString()),
                     from t in triangles
                         select new XElement("face",
                             new XAttribute("v1", t.i),
                             new XAttribute("v2", t.j),
                             new XAttribute("v3", t.k))
                     ),
                 new XElement("geometry",
                     new XAttribute("vertexcount", vertices.Length.ToString()),
                     new XElement("vertexbuffer",
                         new XAttribute("positions", "true"),
                         new XAttribute("normals", "true"),
                         new XAttribute("texture_coords", 1),
                         new XAttribute("texture_coord_dimensions_0", 2),
                         new XAttribute("tangents", "true"),
                         from v in vertices
                             select new XElement("vertex",
                                 new XElement("position",
                                     new XAttribute("x", v.x),
                                     new XAttribute("y", v.y),
                                     new XAttribute("z", v.z)),
                                 new XElement("normal",
                                     new XAttribute("x", Vertex.UnpackNormal(v.normal, 0)),
                                     new XAttribute("y", Vertex.UnpackNormal(v.normal, 1)),
                                     new XAttribute("z", Vertex.UnpackNormal(v.normal, 2))),
                                 new XElement("texcoord",
                                     new XAttribute("u", v.u),
                                     new XAttribute("v", v.v)),
                                 new XElement("tangent",
                                     new XAttribute("x", Vertex.UnpackNormal(v.tangent, 0)),
                                     new XAttribute("y", Vertex.UnpackNormal(v.tangent, 1)),
                                     new XAttribute("z", Vertex.UnpackNormal(v.tangent, 2)))
                                 )
                         )
                     ),
                 new XElement("boneassignments",
                     from pair in vertices.Select((v,index)=>new KeyValuePair<Vertex,int>(v,index))
                         let v = pair.Key
                         let i = pair.Value
                         from a in (from ind in Enumerable.Range(0,4)
                            let bone = (v.packed_bone_indices >> (ind * 8)) & 0xff
                            let weight = (v.packed_bone_weights >> (ind * 8)) & 0xff
                            where weight != 0
                            select new { bone, weight=weight/255.0f })
                         select new XElement("vertexboneassignment",
                             new XAttribute("vertexindex", i),
                             new XAttribute("boneindex", a.bone),
                             new XAttribute("weight", a.weight))
                     )
                 )
             )
         );
     mesh.Save(uri);
 }
开发者ID:VFedyk,项目名称:sporemaster,代码行数:63,代码来源:OgreXmlWriter.cs


注:本文中的Vertex.Select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。