private void initialize() { jointing[0] = null; jointing[1] = null; start = null; end = null; }
public OriEdge(OriVertex x1, OriVertex x2) { initialize(); this.start = x1; this.end = x2; direction = x1.p - x2.p; }
public bool IsExitVertex(OriVertex v) { if (v == start || v == end) { return(true); } return(false); }
private void AddVertex(OriVertex v, int num) { if (num != 0) { edges.Add(new OriEdge(vertexs[edges.Count - 1], v)); } vertexs.Insert(num, v); }
public OriEdge(OriVertex x1, OriVertex x2) { initialize(); this.start = x1; this.end = x2; direction[0] = (x1.p_origin - x2.p_origin).normalized; direction[1] = (x2.p_origin - x1.p_origin).normalized; direction_p[0] = (x1.p - x2.p).normalized; direction_p[1] = (x2.p - x1.p).normalized;/* * direction = (x1.p_origin - x2.p_origin).normalized; * direction_p = (x1.p - x2.p).normalized;*/ }
public void RegisterVertex(float x_origin, float y_origin, float x, float y) { x_origin *= MAX_SIZE / PAPER_SIZE; y_origin *= MAX_SIZE / PAPER_SIZE; x *= MAX_SIZE / PAPER_SIZE; y *= MAX_SIZE / PAPER_SIZE; OriVertex v = new OriVertex(new Vector2(x_origin, y_origin), new Vector2(x, y), vertex_count); vertexs.Add(v); vertex_count++; }
public List <OriEdge> EdgesIncludeVertex(OriVertex v) { List <OriEdge> edge = new List <OriEdge>(); for (int i = 0; i < edges.Count; i++) { if (edges[i].IsExitVertex(v)) { edge.Add(edges[i]); } } return(edge); }
private void AddVertex(OriVertex v, int num) { vertexs.Add(v); }
public OriVertex oppositeVertex(OriVertex v) { return(v == start ? end : start); }
public void RegisterVertex(float x_origin, float y_origin, float x, float y) { OriVertex v = new OriVertex(new Vector2(x_origin, y_origin), new Vector2(x, y)); vertexs.Add(v); }