private bool FormsEar(int A, int B, int C) { wVector V0 = new wVector(pgon.Points[A], pgon.Points[B]); wVector V1 = new wVector(pgon.Points[C], pgon.Points[B]); if (V0.GetAngle(V1) > 0) { return(false); } wPolyline triangle = new wPolyline(new wPoint[] { pgon.Points[A], pgon.Points[B], pgon.Points[C] }); for (int i = 0; i < pgon.Points.Count; i++) { if ((i != A) && (i != B) && (i != C)) { if (triangle.IsPointInside(pgon.Points[i])) { return(false); } } } return(true); }
public wDirectionalLight(wVector Light_Direction) { Direction = Light_Direction; SetWPFLight(); }
public wDirectionalLight(wVector Light_Direction, wColor Light_Color) { Direction = Light_Direction; LightColor = Light_Color; SetWPFLight(); }
public wNormal(wVector NormalVector, int VertexIndex) { X = NormalVector.X; Y = NormalVector.Y; Z = NormalVector.Z; Index = VertexIndex; }
private void SetUp() { double X = Math.Cos(Pivot) * Math.Sin(Tilt + Math.PI / 2) * Distance; double Y = Math.Sin(Pivot) * Math.Sin(Tilt + Math.PI / 2) * Distance; double Z = Math.Cos(Tilt + Math.PI / 2) * Distance; Up = new wVector(X, Y, Z); }
private void SetDirection() { double X = (Target.X - Location.X); double Y = (Target.Y - Location.Y); double Z = (Target.Z - Location.Z); Direction = new wVector(X, Y, Z); }
public wCameraStandard(wPoint PositionPoint, wPoint TargetPoint, wVector UpVector, double Length) { SetLocation(PositionPoint); SetTarget(TargetPoint); Up = UpVector; LensLength = Length; }
public wDirectionalLight(double Light_Intensity, wVector Light_Direction, wColor Light_Color) { Direction = Light_Direction; Intensity = Light_Intensity; LightColor = new AdjustColor(Light_Color).SetLuminance(Intensity / 100.00); SetWPFLight(); }
public wLine(wPoint StartPoint, wVector Direction, double Length) { Points.AddRange(new List <wPoint>() { Start, End }); Indices.AddRange(new List <int>() { 0, 1 }); }
public bool IsPointInside(wPoint TestPoint, double Tolerance = 0.000001) { int count = Points.Count - 1; double sumAngle = new wVector(Points[count].X - TestPoint.X, Points[count].Y - TestPoint.Y, 0).GetAngle(new wVector(Points[0].X - TestPoint.X, Points[0].Y - TestPoint.Y, 0)); for (int i = 0; i < count; i++) { sumAngle += new wVector(Points[i].X - TestPoint.X, Points[i].Y - TestPoint.Y, 0).GetAngle(new wVector(Points[i + 1].X - TestPoint.X, Points[i + 1].Y - TestPoint.Y, 0)); } return(Math.Abs(sumAngle) > (0.000001)); }
public wLine(wPoint StartPoint, wPoint EndPoint) { Start = StartPoint; End = EndPoint; Points.AddRange(new List <wPoint>() { Start, End }); Indices.AddRange(new List <int>() { 0, 1 }); Direction = new wVector(Start, End); }
public wLine(double StartX, double StartY, double EndX, double EndY) { Start = new wPoint(StartX, StartY); End = new wPoint(EndX, EndY); Points.AddRange(new List <wPoint>() { Start, End }); Indices.AddRange(new List <int>() { 0, 1 }); Direction = new wVector(Start, End); }
public bool IsConvex() { int count = Points.Count; bool isNegative = false; bool isPositive = false; bool result = false; int i, j, k; wVector Va, Vb, Vc; for (i = 0; i < count; i++) { j = (i + 1) % count; k = (j + 1) % count; Va = new wVector(Points[j], Points[i]); Vb = new wVector(Points[j], Points[k]); Vc = Va.GetCrossProduct(Vb); if (Vc.Z < 0) { isNegative = true; } else if (Vc.Z > 0) { isPositive = true; } result = (isNegative && isPositive); if (result) { break; } } return(result); }
public void SetScale() { double X = (Frame.Width / Boundary.Width); double Y = (Frame.Height / Boundary.Height); if (X < Y) { Scale = X; } else { Scale = Y; } double W = Boundary.Width * Scale; double H = Boundary.Height * Scale; Extents = new wRectangle(new wPlane(new wPoint(Boundary.Center.X * Scale, Boundary.Center.Y * Scale, 0), Boundary.Plane.XAxis, Boundary.Plane.YAxis), Boundary.Width * Scale, Boundary.Height * Scale); wVector Shift = new wVector(Frame.Center, Extents.Center); Xform.Children.Clear(); Xform.Children.Add(new TranslateTransform(Shift.X, Shift.Y)); }
public wPoint Get2dCentroid() { double Xs = 0; double Ys = 0; wVector Center = new wVector(); for (int i = 0; i < Points.Count - 1; i++) { double f = Points[i].X * Points[i + 1].Y - Points[i + 1].X * Points[i].Y; Xs += (Points[i].X + Points[i + 1].X) * f; Ys += (Points[i].Y + Points[i + 1].Y) * f; } double area = GetArea(); Xs /= (6 * area); Ys /= (6 * area); Xs = -Xs; Ys = -Ys; return(new wPoint(Xs, Ys, 0)); }
public void SetCameraPosition(wPoint LocationPoint, wPoint TargetPoint, wVector UpVector) { RhinoViewer.Viewport.SetCameraLocation(new Rhino.Geometry.Point3d(LocationPoint.X, LocationPoint.Y, LocationPoint.Z), false); RhinoViewer.Viewport.SetCameraTarget(new Rhino.Geometry.Point3d(TargetPoint.X, TargetPoint.Y, TargetPoint.Z), false); RhinoViewer.Viewport.CameraUp = new Rhino.Geometry.Vector3d(UpVector.X, UpVector.Y, UpVector.Z); }