//Draw line between pStart and pEnd with color(c) on keyboard(k) public void DrawLineAt(Color c, PointF pStart, PointF pEnd) { int res = 23; for (int x = 0; x < res; x++) { DrawAt(c, PointF3D.Lerp(pStart, pEnd, x / (float)res)); } }
//Draw line between pStart and pEnd with color(c) on keyboard(k) public void DrawLineAt(ConsoleColor c, PointF pStart, PointF pEnd) { int res = canvSize.Width; for (int x = 0; x < res; x++) { DrawAt(c, PointF3D.Lerp(pStart, pEnd, x / (float)res)); } }
//Draw line between pStart and pEnd with color(c) on keyboard(k) public static void LEDDrawLineAt(CorsairKeyboard k, Color c, PointF pStart, PointF pEnd) { int res = 23; for (int x = 0; x < res; x++) { LEDDrawAt(k, c, PointF3D.Lerp(pStart, pEnd, x / (float)res)); } }
public static Model AskModel(ModelProps modelProps) { Console.Clear(); Console.WriteLine("Dette er så en udvidelse af programmet, til at starte med kan du vælge om du vil \nprøve at projektere en kasse, et standard objekt eller et valgfrit objekt"); Console.WriteLine("Skriv 'b' for at vælge kassen"); Console.WriteLine("Skriv 'd' for at vælge det standard objekt"); Console.WriteLine("Alle andre taster for at vælge et objekt selv"); Console.Write("Skriv her: "); var whichA = Console.ReadKey(); var which = whichA.KeyChar; if (which == 'b') { return(GetBox(modelProps)); } else if (which == 'd') { float scale = 0.002f; PointF3D translationToMid = new PointF3D(0, -500); PointF3D rotation = new PointF3D(0, 0, (float)Math.PI); var model = OBJExtractor.GetModel(Path.GetFullPath(@"Files to try out\deer.obj"), translationToMid, rotation, scale); modelProps.rotateAmount = Math.PI / 16d; modelProps.wFLineSize = 1; modelProps.wFPointSize = 2; modelProps.displayPoints = false; modelProps.displayFaces = true; return(model); } else { Console.Clear(); Console.WriteLine("Du har valgt at vælge selv. "); string path = AskForPath(); Console.WriteLine(""); float scale = AskForFloatProperty("Her angives modellens størrelse", "Scale", 1f); Console.WriteLine(""); PointF3D translationToMid = AskForPoint3DProperty("Her angives hvor meget modellen skal skubbes for at rotationsaksen ligger i midten", new PointF3D()); Console.WriteLine(""); PointF3D rotation = AskForPoint3DProperty("Her angives modellen starts rotation i radianer, hvor x, y, og z er aksen den rotere omkring", new PointF3D()); Console.WriteLine(""); modelProps.rotateAmount = AskForFloatProperty("Her angives hvor meget man ønsker modellen skal roteres per billede tegnet.", "Rotations mængde", (float)(Math.PI / 8d)); Console.Clear(); Console.WriteLine("Super, vi prøver altså at vise fra denne sti: \n" + path + "\n"); Console.WriteLine("Med scale: \n" + scale + "\n"); Console.WriteLine("Med translator til rotations midtpunkt: \n" + translationToMid + "\n"); Console.WriteLine("Og med starts rotation: \n" + translationToMid + "\n"); Console.Write("Tryk en vilkårlig tast for at fortsætte"); Console.ReadKey(); return(OBJExtractor.GetModel(path, translationToMid, rotation, scale)); } }
public static PointF3D AskForPoint3DProperty(string msg, PointF3D defaultVal) { var returnPoint = new PointF3D(); if (msg != "") { Console.WriteLine(msg); Console.WriteLine("Angiv et decimal tal, eller efterlad tom for standard værdi"); } returnPoint.x = AskForFloatProperty("", "x", defaultVal.x); returnPoint.y = AskForFloatProperty("", "y", defaultVal.y); returnPoint.z = AskForFloatProperty("", "z", defaultVal.z); return(returnPoint); }
private void button2_Click(object sender, EventArgs e) { PointF3D P1 = new PointF3D((float)Double.Parse(textBox1.Text), (float)Double.Parse(textBox2.Text), (float)Double.Parse(textBox3.Text)); PointF3D P2 = new PointF3D((float)Double.Parse(textBox4.Text), (float)Double.Parse(textBox5.Text), (float)Double.Parse(textBox6.Text)); PointF3D P3 = new PointF3D((float)Double.Parse(textBox7.Text), (float)Double.Parse(textBox8.Text), (float)Double.Parse(textBox9.Text)); String wynik = ""; float p1, p2, p3; p1 = (P1.x - P2.x) * (P3.x - P1.x); p2 = (P1.y - P2.y) * (P3.y - P1.y); p3 = (P1.z - P2.z) * (P3.z - P1.z); wynik += p1 + "(x-" + P1.x + ") + "; wynik += p2 + "(y-" + P1.y + ") + "; wynik += p3 + "(z-" + P1.z + ") = 0"; label25.Text = wynik; }