JuicyGraphics/src/JuicyGraphics/renderer/graphicalObjects/line.cs
2019-02-14 15:46:16 +01:00

97 lines
2.8 KiB
C#

using SharpGL;
using System.Numerics;
namespace Graphics.Objects {
class line : iGraphicalObject {
#region fields
Vector2 pt01;
Vector2 pt02;
double thickness01;
double thickness02;
double tilt01;
double tilt02;
#endregion
#region properties
#endregion
#region constructors
public line(Vector2 startPoint, Vector2 endPoint) {
pt01 = startPoint;
pt02 = endPoint;
thickness01 = 1.0;
thickness02 = 1.0;
tilt01 = 0.0;
tilt02 = 0.0;
}
public line(Vector2 startPoint, Vector2 endPoint, double thickness) {
pt01 = startPoint;
pt02 = endPoint;
thickness01 = thickness;
thickness02 = thickness;
tilt01 = 0.0;
tilt02 = 0.0;
}
public enum valueing { defineLinearThickness, defineBothTilts }
public line(Vector2 startPoint, Vector2 endPoint,
valueing defineType, double startPointParam, double endPointParam) {
pt01 = startPoint;
pt02 = endPoint;
switch (defineType) {
case valueing.defineLinearThickness:
thickness01 = startPointParam;
thickness02 = endPointParam;
tilt01 = 0.0;
tilt02 = 0.0;
break;
case valueing.defineBothTilts:
thickness01 = 1.0;
thickness02 = 1.0;
tilt01 = startPointParam;
tilt02 = endPointParam;
break;
default:
thickness01 = 1.0;
thickness02 = 1.0;
tilt01 = 0.0;
tilt02 = 0.0;
break;
}
}
public line(Vector2 startPoint, Vector2 endPoint,
double thickness, double tiltOfStartPoint, double tiltOfEndPoint) {
pt01 = startPoint;
pt02 = endPoint;
thickness01 = thickness;
thickness02 = thickness;
tilt01 = tiltOfStartPoint;
tilt02 = tiltOfEndPoint;
}
public line(Vector2 startPoint, Vector2 endPoint,
double thicknessOfStartPoint, double thicknessOfEndPoint,
double tiltOfStartPoint, double tiltOfEndPoint) {
pt01 = startPoint;
pt02 = endPoint;
thickness01 = thicknessOfStartPoint;
thickness02 = thicknessOfEndPoint;
tilt01 = tiltOfStartPoint;
tilt02 = tiltOfEndPoint;
}
#endregion
public void render(renderCam context) {
context.drawQuad(pt01, pt01 + new Vector2(0.03f, 0), pt02 + new Vector2(0.03f, 0), pt02);
}
}
}