本文整理汇总了C#中IVertex类的典型用法代码示例。如果您正苦于以下问题:C# IVertex类的具体用法?C# IVertex怎么用?C# IVertex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IVertex类属于命名空间,在下文中一共展示了IVertex类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PathRecord
public PathRecord(IVertex target, double weight, IList<IEdge> edgeTracks)
{
Target = target;
Weight = weight;
EdgeTracks = edgeTracks.ToArray();
ParseVertexTracks(edgeTracks);
}
示例2: VertexRegister
internal VertexRegister(IVertex currentVertex)
{
Vertex = currentVertex;
Registed = false;
TotalWeight = double.MaxValue;
EdgeTracks = new List<IEdge>();
}
示例3: Push
/// <summary>
/// Push a new vertex on the buffer.
/// </summary>
/// <param name="v">new vertex</param>
public override void Push(IVertex v)
{
// add to queue
base.Push(v);
// sort queue
Sort(m_Comparer);
}
示例4: Visit
private static void Visit(IVertex node, ColorsSet colors,
TimestampSet discovery, TimestampSet finish, LinkedList<IVertex> list, ref int time)
{
colors.Set(node, VertexColor.Gray);
discovery.Register(node, time++);
foreach(IVertex child in node.Adjacencies)
{
if (colors.ColorOf(child) == VertexColor.White)
{
Visit(child, colors, discovery, finish, list, ref time);
}
}
finish.Register(node, time++);
#if DEBUG
Debug.Assert(discovery.TimeOf(node) < finish.TimeOf(node));
#endif
list.AddFirst(node);
colors.Set(node, VertexColor.Black);
}
示例5: FanMotif
public FanMotif(IVertex headVertex,IVertex[] leafVertices)
{
m_oHeadVertex = headVertex;
m_aoLeafVertices = leafVertices;
m_dArcScale = 1.0;
}
示例6: CheckInnerPoint
// Kiem tra 1 diem co nam trong da giac khong
public static bool CheckInnerPoint(IVertexCollection points, IVertex point)
{
IVertex currentPoint = point;
//Ray-cast algorithm is here onward
int k, j = points.Count - 1;
var oddNodes = false; //to check whether number of intersections is odd
for (k = 0; k < points.Count; k++)
{
//fetch adjucent points of the polygon
IVertex polyK = points[k];
IVertex polyJ = points[j];
//check the intersections
if (((polyK.Y > currentPoint.Y) != (polyJ.Y > currentPoint.Y)) &&
(currentPoint.X < (polyJ.X - polyK.X) * (currentPoint.Y - polyK.Y) / (polyJ.Y - polyK.Y) + polyK.X))
oddNodes = !oddNodes; //switch between odd and even
j = k;
}
//if odd number of intersections
if (oddNodes)
{
//mouse point is inside the polygon
return true;
}
//if even number of intersections
return false;
}
示例7: Quad
public Quad()
{
Vertices = new IVertex[]
{
new Vertex
{
Position = new Vector3(-1f, -1f, 0f),
Color = Color.White,
Texcoords = new Texcoords(new Vector2(0f, 0f))
},
new Vertex
{
Position = new Vector3(1f, -1f, 0f),
Color = Color.White,
Texcoords = new Texcoords(new Vector2(1f, 0f))
},
new Vertex
{
Position = new Vector3(1f, 1f, 0f),
Color = Color.White,
Texcoords = new Texcoords(new Vector2(1f, 1f))
},
new Vertex
{
Position = new Vector3(-1f, 1f, 0f),
Color = Color.White,
Texcoords = new Texcoords(new Vector2(0f, 1f))
},
};
Indices = new short[] { 0, 1, 2, 0, 2, 3 };
}
示例8: VertexType
/// <summary>
/// Creates a new instance of VertexType.
/// </summary>
/// <param name="myVertexTypeVertex">An IVertex that represents the vertex type.</param>
internal VertexType(IVertex myVertexTypeVertex)
: base(myVertexTypeVertex)
{
_hasOwnUniques = HasOutgoingEdge(AttributeDefinitions.VertexTypeDotUniquenessDefinitions);
_hasOwnIndices = HasIncomingVertices(BaseTypes.Index, AttributeDefinitions.IndexDotDefiningVertexType);
_hasChilds = HasIncomingVertices(BaseTypes.VertexType, AttributeDefinitions.VertexTypeDotParent);
}
示例9: Add
public void Add(IVertex current_node, double current_distance, UInt64 current_depth)
{
var id = current_node.VertexID;
_buffer.Add(Tuple.Create(current_distance, id), Tuple.Create(current_node, current_distance, current_depth));
_count++;
}
示例10: ExecFunc
/// <summary>
/// Executes the function on myCallingObject
/// </summary>
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
{
var currentInnerEdgeType = ((IOutgoingEdgeDefinition)myAttributeDefinition).InnerEdgeType;
if (myCallingObject is IHyperEdge && currentInnerEdgeType.HasProperty("Weight"))
{
var hyperEdge = myCallingObject as IHyperEdge;
if (currentInnerEdgeType.HasProperty("Weight"))
{
var weightProperty = currentInnerEdgeType.GetPropertyDefinition("Weight");
var maxWeight = hyperEdge.InvokeHyperEdgeFunc<Double>(singleEdges =>
{
return Convert.ToDouble(
weightProperty.GetValue(
singleEdges
.OrderByDescending(edge => weightProperty.GetValue(edge))
.First()));
});
return new FuncParameter(maxWeight);
}
}
throw new InvalidTypeException(myCallingObject.GetType().ToString(), "Weighted IHyperEdge");
}
示例11: ExecFunc
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
{
if (!(myCallingObject is String))
{
throw new FunctionParameterTypeMismatchException(typeof(String), myCallingObject.GetType());
}
var pos = Convert.ToInt32(myParams[0].Value);
StringBuilder resString = new StringBuilder();
bool dontInsert = false;
if (pos > (myCallingObject as String).Length)
{
dontInsert = true;
resString.Append((myCallingObject as String).ToString());
}
else
{
resString.Append((myCallingObject as String).ToString().Substring(0, pos));
}
foreach (FuncParameter fp in myParams.Skip(1))
{
resString.Append(fp.Value as String);
}
if(!dontInsert)
resString.Append((myCallingObject as String).ToString().Substring(pos));
return new FuncParameter(resString.ToString());
}
示例12: AddRange
/// <summary>
/// Adds the elements of an array to the end of this VertexCollection.
/// </summary>
/// <param name="items">
/// The array whose elements are to be added to the end of this VertexCollection.
/// </param>
public void AddRange(IVertex[] items)
{
foreach (IVertex item in items)
{
this.List.Add(item);
}
}
示例13: ReducePathDistance
public void ReducePathDistance(IVertexDistanceMatrix distances, IVertex source, IVertex target, IVertex intermediate)
{
if ((source == target) && (distances.Distance(source, target) < 0.0))
{
throw new Exception("Negative cycle");
}
}
开发者ID:NigelThorne,项目名称:ndependencyinjection,代码行数:7,代码来源:FloydWarshallNegativeCycleDistanceReducer.cs
示例14: BuildEstablishment
public IEstablishment BuildEstablishment(IVertex vertex, IPlayer owner)
{
if (vertex == null)
throw new ArgumentNullException(nameof(vertex));
if (owner == null)
throw new ArgumentNullException(nameof(owner));
if (!Vertices.Contains(vertex))
throw new ArgumentException("Did not find the passed vertex on the board");
if (establishments.Any(e => e.Vertex == vertex))
throw new ArgumentException("Invalid vertex, already an establishment here");
var vertices = Vertices.Where(v => v.IsAdjacentTo(vertex));
var tiles = Tiles.Where(t => t.IsAdjacentTo(vertex));
if (establishments.Any(e => vertices.Contains(e.Vertex)))
throw new ArgumentException("Invalid vertex, establishment can't be placed next to another establishment");
if (tiles.All(t => t.Rawmaterial == MaterialType.Sea))
throw new ArgumentException("Can't place an establishment on sea!");
if (establishments.Count(e => e.Owner == owner) >= 2 &&
roads.Where(r => r.Owner == owner).All(r => !r.Edge.IsAdjacentTo(vertex)))
throw new InvalidOperationException("Each player can only build 2 houses without adjacent roads!");
var establishment = new Establishment(owner, vertex);
establishments.Add(establishment);
logger.Info($"Establisment Build; Player {owner.Name}, {vertex.ToString()}");
return establishment;
}
示例15: ChildVertices
/// <summary>
/// Gets an enumerable collection of child <see cref="IVertex"/>
/// </summary>
/// <param name="v">current <see cref="IVertex"/></param>
/// <returns>An enumerable collection of adjacent vertices</returns>
/// <exception cref="ArgumentNullException">
/// <paramref name="v"/> is a null reference
/// </exception>
public IVertexEnumerable ChildVertices(IVertex v)
{
if (v==null)
throw new ArgumentNullException("v");
return new TargetVertexEnumerable(this.Wrapped.OutEdges(v));
}