text
stringlengths
0
234
Original_X, Original_Y : GL.Types.Double := 0.0;
Delta_X, Delta_Y : GL.Types.Double := 0.0;
Selected_Point, Hovered_Point : Natural := 0;
Algorithm : Algorithm_Type := DE_CASTELIJAU;
Help_Overlay_Required : Boolean := False;
Display_Control_Polygon : Boolean := True;
Knot_Values : CRV.Knot_Values_Array (1 .. Num_Of_Knots_Type'Last) :=
(1 => 0.0,
2 => 0.0,
3 => 0.0,
4 => 0.1,
5 => 0.3,
6 => 0.5,
7 => 0.5,
8 => 0.5,
9 => 0.7,
10 => 0.9,
11 => 1.0,
12 => 1.0,
13 => 1.0,
others => 0.0);
Num_Of_Knots : Num_Of_Knots_Type := 13;
Selected_Knot, Hovered_Knot : Natural := 0;
Hovered_Ruler : Boolean := False;
end record;
-- Fwd Declared Procedures and Functions
------------------------------------
function Calculate_Knot_H_Pos(Knot_Value : in CRV.Parametrization_Type) return GL.Types.Double;
function Calculate_Knot_Value(H_Pos : in Glfw.Input.Mouse.Coordinate) return CRV.Parametrization_Type;
function Calculate_B_Spline_Degree return Integer;
procedure Uniformise_Knot_Vector(V : in out CRV.Knot_Values_Array;
Degree : in Integer);
-- Overrides
---------------------------
overriding
procedure Init (Object : not null access Test_Window;
Width, Height : Glfw.Size;
Title : String;
Monitor : Glfw.Monitors.Monitor := Glfw.Monitors.No_Monitor;
Share : access Glfw.Windows.Window'Class := null);
overriding
procedure Mouse_Position_Changed (Object : not null access Test_Window;
X, Y : Glfw.Input.Mouse.Coordinate);
overriding
procedure Mouse_Button_Changed (Object : not null access Test_Window;
Button : Glfw.Input.Mouse.Button;
State : Glfw.Input.Button_State;
Mods : Glfw.Input.Keys.Modifiers);
overriding
procedure Key_Changed (Object : not null access Test_Window;
Key : Glfw.Input.Keys.Key;
Scancode : Glfw.Input.Keys.Scancode;
Action : Glfw.Input.Keys.Action;
Mods : Glfw.Input.Keys.Modifiers);
-- Procedures and Functions
---------------------------
procedure Init (Object : not null access Test_Window;
Width, Height : Glfw.Size;
Title : String;
Monitor : Glfw.Monitors.Monitor := Glfw.Monitors.No_Monitor;
Share : access Glfw.Windows.Window'Class := null) is
Upcast : Glfw.Windows.Window_Reference
:= Glfw.Windows.Window (Object.all)'Access;
begin
Upcast.Init (Width, Height, Title, Monitor, Share);
Object.Enable_Callback (Glfw.Windows.Callbacks.Mouse_Position);
Object.Enable_Callback (Glfw.Windows.Callbacks.Mouse_Button);
Object.Enable_Callback (Glfw.Windows.Callbacks.Key);
end Init;
procedure Mouse_Position_Changed (Object : not null access Test_Window;
X, Y : Glfw.Input.Mouse.Coordinate) is
use GL.Types.Doubles;
use type Glfw.Input.Button_State;
subtype Knot_Index_Type is Positive range 1 .. Object.Num_Of_Knots;
procedure Swap_Knots(Index_1, Index_2 : Knot_Index_Type) is
Temp : CRV.Parametrization_Type;
begin
Temp := Object.Knot_Values(Index_1);