public void AddQuad(Vector3 topLeft, Vector3 topRight, Vector3 bottomRight, Vector3 bottomLeft, bool backFace) { var index = Verticies.Count; Verticies.Add(topLeft); Verticies.Add(topRight); Verticies.Add(bottomRight); Verticies.Add(bottomLeft); if (backFace) { Indexes.Add(index); Indexes.Add(index + 1); Indexes.Add(index + 2); Indexes.Add(index + 2); Indexes.Add(index + 3); Indexes.Add(index); } else { Indexes.Add(index); Indexes.Add(index + 3); Indexes.Add(index + 2); Indexes.Add(index + 2); Indexes.Add(index + 1); Indexes.Add(index); } }
private void AddVertex(float x, float y, float texCoord1, float texCoord2) { Verticies.Add(x); Verticies.Add(y); Verticies.Add(texCoord1); Verticies.Add(texCoord2); }
public Quad(XElement element) { Verticies.Add(GetVertFromXmlAttribute(element, FIRST_VERTEX_ID)); Verticies.Add(GetVertFromXmlAttribute(element, SECOND_VERTEX_ID)); Verticies.Add(GetVertFromXmlAttribute(element, THIRD_VERTEX_ID)); Verticies.Add(GetVertFromXmlAttribute(element, FOURTH_VERTEX_ID)); }
public Vertex AddVertex(int vertexVal) { Vertex vertex = new Vertex(string.Empty, vertexVal); Verticies.Add(vertex); return(vertex); }
public Vertex AddVertex(string vertexName) { Vertex vertex = new Vertex(vertexName); Verticies.Add(vertex); return(vertex); }
public void AddTask(float x, float y, float width, float height, float border, Color color) { float widthMax = width + border + 5.0f; //+5 for AA support float heightMax = height + border + 5.0f; float xc = x + width / 2.0f; float yc = y + height / 2.0f; Verticies.Add(xc - widthMax / 2.0f); Verticies.Add(yc - heightMax / 2.0f); Verticies.Add(xc + widthMax / 2.0f); Verticies.Add(yc - heightMax / 2.0f); Verticies.Add(xc + widthMax / 2.0f); Verticies.Add(yc + heightMax / 2.0f); Verticies.Add(xc - widthMax / 2.0f); Verticies.Add(yc + heightMax / 2.0f); _uniformData.Add(new EllipseData { Color = color, Xc = xc, Yc = yc, Xr = width / 2.0f, Yr = height / 2.0f, Border = border }); }
public void AddTask(Color color, IList <float> positions) { if (positions.Count != 8) { throw new ArgumentException("Positions array should have 8 elements"); } _colorVector.X = color.R * ColorFloat; _colorVector.Y = color.G * ColorFloat; _colorVector.Z = color.B * ColorFloat; _colorVector.W = color.A * ColorFloat; for (int i = 0; i < 4; i++) { Verticies.Add(positions[i * 2]); Verticies.Add(positions[i * 2 + 1]); Verticies.Add(_colorVector.X); Verticies.Add(_colorVector.Y); Verticies.Add(_colorVector.Z); Verticies.Add(_colorVector.W); } }
public Ngon(double[][] edgeVectors) { this.EdgeVectors = encodeArray(edgeVectors); this.Verticies = new List <Vertex>(); this.Edges = new List <Edge>(); double[] cumulative = new double[] { 0, 0 }; foreach (double[] entry in edgeVectors) { Vertex from = new Vertex(cumulative[0], cumulative[1]); Verticies.Add(from); cumulative[0] += entry[0]; cumulative[1] += entry[1]; Vertex to = new Vertex(cumulative[0], cumulative[1]); Edges.Add(new Edge(to, from, entry)); } if (Math.Round(cumulative[0], 8) != 0 && Math.Round(cumulative[1], 8) != 0) { throw (new Exception("Ngon is not closed!")); } calculateAngles(); this.Type = getType(); }
public void AddEdge(int edgeId, int vertexVal1, int vertexVal2, int weight) { Vertex vertex1 = Verticies.FirstOrDefault(item => item.Id == vertexVal1); Edge edge = new Edge(edgeId); if (vertex1 != null) { vertex1 = Verticies[vertexVal1]; } else { vertex1 = new Vertex(vertexVal1); Verticies.Add(vertex1); } Vertex vertex2 = Verticies.FirstOrDefault(item => item.Id == vertexVal2); if (vertex2 != null) { vertex2 = Verticies[vertexVal2]; } else { vertex2 = new Vertex(vertexVal2); Verticies.Add(vertex2); } edge.StartVertex = vertexVal1; edge.EndVertex = vertexVal2; edge.Weight = weight; Edges.Add(edge); vertex1.ForwardEdges.Add(edge.Id); vertex2.BackwardEdges.Add(edge.Id); Console.WriteLine(edgeId + ". " + vertexVal1 + " - " + vertexVal2 + " - " + weight); }
public void AddVertex(Vertex v) { Verticies.Add(v.Id, v); }
/// <summary> /// Adds the given vertex to the mesh /// </summary> /// <param name="Vertex">The vertex to add to the mesh</param> public void AddVertex(SEModelVertex Vertex) { // Add it Verticies.Add(Vertex); }
public void CreateFromMatrix(int[,] matrix, bool display = true, bool isDirected = false) { Clear(); this.IsDirected = isDirected; this.IsWeighted = IsWeighted; for (int lpRCnt = 0; lpRCnt < matrix.GetLength(0); lpRCnt++) { Verticies.Add(new Vertex() { Name = NameValues[lpRCnt], Value = lpRCnt }); } for (int lpRCnt = 0; lpRCnt < matrix.GetLength(0); lpRCnt++) { for (int lpCCnt = 0; lpCCnt < matrix.GetLength(1); lpCCnt++) { if (matrix[lpRCnt, lpCCnt] != 0) { if (Verticies[lpRCnt].Adjacents == null) { Verticies[lpRCnt].Adjacents = new List <Edge>(); } Verticies[lpRCnt].Adjacents.Add(new Edge(Verticies[lpCCnt], matrix[lpRCnt, lpCCnt])); if (isDirected == false) { if (Verticies[lpCCnt].Adjacents == null) { Verticies[lpCCnt].Adjacents = new List <Edge>(); } Verticies[lpCCnt].Adjacents.Add(new Edge(Verticies[lpRCnt], matrix[lpRCnt, lpCCnt])); } } } } //if (isDirected == false) //{ // for (int lpRCnt = 0; lpRCnt < matrix.GetLength(0); lpRCnt++) // { // for (int lpCCnt = 0; lpCCnt < matrix.GetLength(1); lpCCnt++) // { // if (matrix[lpRCnt, lpCCnt] != 0) // { // if (Verticies[lpRCnt].Adjacents == null) // Verticies[lpRCnt].Adjacents = new List<Edge>(); // Verticies[lpCCnt].Adjacents.Add(new Edge(Verticies[lpRCnt], matrix[lpRCnt, lpCCnt])); // } // } // } //} if (display == true) { for (int lpRCnt = 0; lpRCnt < matrix.GetLength(0); lpRCnt++) { for (int lpCCnt = 0; lpCCnt < matrix.GetLength(1); lpCCnt++) { Console.Write(matrix[lpRCnt, lpCCnt] + " "); } Console.WriteLine(); } } }
public Box(XElement element) { Verticies.Add(GetVertFromXmlAttribute(element, FIRST_CORNER_ID)); Verticies.Add(GetVertFromXmlAttribute(element, SECOND_CORNER_ID)); }