From 7532850044209849f37ffc7d2e3290bd2239f973 Mon Sep 17 00:00:00 2001 From: fdai6887 Date: Tue, 7 Feb 2023 01:18:48 +0100 Subject: [PATCH] add vPunkt --- src/funktion.c | 14 ++++++++++++++ src/funktion.h | 1 + src/main.c | 27 +++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/src/funktion.c b/src/funktion.c index 3061755..86aa1a1 100644 --- a/src/funktion.c +++ b/src/funktion.c @@ -235,3 +235,17 @@ double Vangle(float x1, float x2, float x3, float z1, float z2, float z3) { double result = acos(s) * 180 / M_PI; return 11; } +float vPunkt(float x1, float x2, float x3, float z1, float z2, float z3, float p1, float p2, float p3) { + float e1 = (p1 - x1) / z1; + float e2 = (p2 - x2) / z2; + float e3 = (p3 - x3) / z3; + + if (e1 == e2 && e2 == e3) { + printf("Punkt liegt auf Vektor\n\n"); + return 1; + } else { + printf("Punkt liegt nicht auf Vektor\n\n"); + return 0; + } + return 0; +} diff --git a/src/funktion.h b/src/funktion.h index e579e16..80c9c75 100644 --- a/src/funktion.h +++ b/src/funktion.h @@ -40,5 +40,6 @@ float Vmiddle2(float x2, float z2); float Vmiddle3(float x3, float z3); float Vskalort(float x1, float x2, float x3, float z1, float z2, float z3); double Vangle(float x1, float x2, float x3, float z1, float z2, float z3); +float vPunkt(float x1, float x2, float x3, float z1, float z2, float z3, float p1, float p2, float p3); #endif diff --git a/src/main.c b/src/main.c index 1f9313f..8a818bc 100644 --- a/src/main.c +++ b/src/main.c @@ -182,4 +182,31 @@ int main() z2 = getValue('Z'); z3 = getValue('Z'); Vangle(x1,x2,x3,z1,z2,z3); + + printf("Stuetzvektor\n"); + printf("1. Vektor\n"); + printf("x eingeben"); + x1 = getValue('X'); + printf("y eingeben "); + x2 = getValue('X'); + printf("z eingeben"); + x3 = getValue('X'); + + printf("2. Vektor\n"); + printf("a eingeben"); + z1 = getValue('Z'); + printf("b eingeben "); + z2 = getValue('Z'); + printf("c eingeben"); + z3 = getValue('Z'); + + printf("Punkt\n"); + printf("2. Vektor\n"); + printf("P1 eingeben"); + p1 = getValue('P'); + printf("P2 eingeben "); + p2 = getValue('P'); + printf("P3 eingeben"); + p3 = getValue('P'); + vPunkt(x1,x2,x3,z1,z2,z3,p1,p2,p3); }