//Kai Milberg
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Geometrie
{
class Dreieck
{
public Point A, B, C;
public Dreieck dreieck1,
dreieck2,
dreieck3;
public Dreieck(double a, double b, double c)
{
A = a;
B = b;
C = c;
}
public void Cut()
{
Punkt AB;
Punkt BC;
Punkt CA;
AB = new Punkt((A.X + B.X) / 2, (A.Y + B.Y) / 2);
BC = new Punkt((B.X + C.X) / 2, (B.Y + C.Y) / 2);
CA = new Punkt((C.X + A.X) / 2, (C.Y + A.Y) / 2);
dreieck1 = new Dreieck(A, AB, CA);
dreieck2 = new Dreieck(AB, B, BC);
dreieck3 = new Dreieck(CA, BC, C);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Geometrie
{
class Dreieck2
{
public class Triangle
{
// Triangle members.
Point P1;
Point P2;
Point P3;
public Point Point1 {
get {
return P1;
}
set {
P1 = value;
}
}
public Point Point2 {
get
{
return P2;
}
set
{
P2 = value;
}
}
public Point Point3 {
get
{
return P3;
}
set
{
P3 = value;
}
}
public Triangle(Point point1,Point point2,Point point3) {
P1 = point1;
P2 = point2;
P3 = point3;
}
}
}
//Kai Milberg
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Geometrie
{
class Kreis
{
class Circle
{
// Felder
int XKoordinate { get; set; }
int YKoordinate { get; set; }
double radius = 0;
int countCircles;
bool counterReduced = false;
// Konstruktoren
public Circle()
{
countCircles++;
}
public Circle(double radius)
: this()
{
this.Radius = radius;
}
public Circle(double radius, int xPos, int yPos)
: this(radius)
{
XKoordinate = xPos;
YKoordinate = yPos;
}
// Destruktor
~Circle()
{
if (!counterReduced)
countCircles--;
}
// Eigenschaftsmethoden
public double Radius
{
get
{
return radius;
}
set
{
if (value >= 0)
radius = value;
else
Console.Write("Unzulässiger Wert.");
}
}
public int CountCircles
{
get { return countCircles; }
}
public void Dispose()
{
if (!counterReduced)
{
countCircles--;
counterReduced = true;
}
}
// ------ Klassenmethoden ------
public static double GetFlaeche(double radius)
{
return Math.PI * Math.Pow(radius, 2);
}
public static double GetUmfang(double radius)
{
return 2 * Math.PI * radius;
}
public static Circle Bigger(Circle kreis1, Circle kreis2)
{
if (kreis1.radius >= kreis2.radius)
return kreis1;
return kreis2;
}
public static Circle Bigger(Circle kreis1, Circle kreis2, out bool equal)
{
equal = false;
if (kreis1.radius == kreis2.radius)
equal = true;
return Circle.Bigger(kreis1, kreis2);
}
public static bool IsBigger(Circle kreis1, Circle kreis2)
{
if (kreis1.radius >= kreis2.radius)
return true;
return false;
}
// ------ Instanzmethoden ------
public double GetUmfang()
{
return 2 * Math.PI * Radius;
}
public double GetFlaeche()
{
return Math.PI * Math.Pow(Radius, 2);
}
public Circle Bigger(Circle kreis)
{
if (this.radius >= kreis.radius)
return this;
return kreis;
}
public Circle Bigger(Circle kreis, out bool equal)
{
equal = false;
if (this.radius == kreis.radius)
equal = true;
return this.Bigger(kreis);
}
}
}
}
//Kai Milberg
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Geometrie
{
class Punkt
{
public class Point3DF
{
float mX;
float mY;
float mZ;
public Point3DF(float X, float Y, float Z)
{
mX = X;
mY = Y;
mZ = Z;
}
public Point3DF()
{
mX = 0;
mY = 0;
mZ = 0;
}
public float X
{
get { return mX; }
set { mX = value; }
}
public float Y
{
get { return mY; }
set { mY = value; }
}
public float Z
{
get { return mZ; }
set { mZ = value; }
}
}
public class Angle3DF
{
private float mX;
private float mY;
private float mZ;
private bool mRad = false;
public Angle3DF(float X, float Y, float Z, bool Radial)
{
mX = X;
mY = Y;
mZ = Z;
mRad = Radial;
}
public Angle3DF()
{
mX = 0;
mY = 0;
mZ = 0;
mRad = false;
}
public float X
{
get { return mX; }
set { mX = value; }
}
public float Y
{
get { return mY; }
set { mY = value; }
}
public float Z
{
get { return mZ; }
set { mZ = value; }
}
public Angle3DF ToRadial()
{
if (mRad)
return this;
else
{
float nx = (float)(mX * Math.PI / 180);
float ny = (float)(mY * Math.PI / 180);
float nz = (float)(mZ * Math.PI / 180);
return new Angle3DF(nx, ny, nz, true);
}
}
public Angle3DF ToDegree()
{
if (!mRad)
return this;
else
{
float nx = (float)(mX * 180 / Math.PI);
float ny = (float)(mY * 180 / Math.PI);
float nz = (float)(mZ * 180 / Math.PI);
return new Angle3DF(nx, ny, nz, false);
}
}
}
}
}
//Kai Milberg
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Geometrie
{
class Punkt
{
public class Point3DF
{
float mX;
float mY;
float mZ;
public Point3DF(float X, float Y, float Z)
{
mX = X;
mY = Y;
mZ = Z;
}
public Point3DF()
{
mX = 0;
mY = 0;
mZ = 0;
}
public float X
{
get { return mX; }
set { mX = value; }
}
public float Y
{
get { return mY; }
set { mY = value; }
}
public float Z
{
get { return mZ; }
set { mZ = value; }
}
}
public class Angle3DF
{
private float mX;
private float mY;
private float mZ;
private bool mRad = false;
public Angle3DF(float X, float Y, float Z, bool Radial)
{
mX = X;
mY = Y;
mZ = Z;
mRad = Radial;
}
public Angle3DF()
{
mX = 0;
mY = 0;
mZ = 0;
mRad = false;
}
public float X
{
get { return mX; }
set { mX = value; }
}
public float Y
{
get { return mY; }
set { mY = value; }
}
public float Z
{
get { return mZ; }
set { mZ = value; }
}
public Angle3DF ToRadial()
{
if (mRad)
return this;
else
{
float nx = (float)(mX * Math.PI / 180);
float ny = (float)(mY * Math.PI / 180);
float nz = (float)(mZ * Math.PI / 180);
return new Angle3DF(nx, ny, nz, true);
}
}
public Angle3DF ToDegree()
{
if (!mRad)
return this;
else
{
float nx = (float)(mX * 180 / Math.PI);
float ny = (float)(mY * 180 / Math.PI);
float nz = (float)(mZ * 180 / Math.PI);
return new Angle3DF(nx, ny, nz, false);
}
}
}
}
}
Keine Kommentare:
Kommentar veröffentlichen