public void ShouldCalculateEuclideanDistanceBetweenVectors() { PVector a = new PVector(1, 0, 0); PVector b = new PVector(0, 1, 0); float distance = a.Dist(b); Assert.Equal((float)Math.Sqrt(2), distance); }
private void setupTriangle() { size(600, 800); translate(0, 100); stroke(255); segments = new List <Segment>(); PVector a = new PVector(0, 100); PVector b = new PVector(600, 100); Segment s1 = new Segment(a, b); float len = PVector.Dist(a, b); float h = (float)(len * Math.Sqrt(3) / 2); PVector c = new PVector(300, 100 + h); Segment s2 = new Segment(b, c); Segment s3 = new Segment(c, a); segments.Add(s1); segments.Add(s2); segments.Add(s3); }