text
stringlengths
0
234
Object.Knot_Values(Index_1) := Object.Knot_Values(Index_2);
Object.Knot_Values(Index_2) := temp;
Function Definition: procedure Draw_Help_Overlay is separate;
Function Body: -- TODO: Postcondition - not hovered and selected at the same time
procedure Determine_Hovered_Object is separate;
function Calculate_B_Spline_Degree return Integer is
begin
return My_Window.Num_Of_Knots - My_Window.Num_Of_Control_Points - 1;
Function Definition: procedure Uniformise_Knot_Vector(V : in out CRV.Knot_Values_Array;
Function Body: Degree : in Integer) is
begin
if V'Last >= 2*(Degree + 1) then
V(V'First .. V'First + Degree) := (others => 0.0);
for I in 1 .. V'Last - 2*(Degree + 1) loop
V(V'First + Degree + I) := CRV.Parametrization_Type(
Float(I) /
Float(V'Last - 2*(Degree + 1) + 1)
);
end loop;
V(V'Last - Degree .. V'Last) := (others => 1.0);
end if;
Function Definition: function Eval_Basis_Poly(J : in Interpolation_Nodes_Index_Type) return Base_Real_Type is
Function Body: D : constant Base_Real_Type := (Parametrization_Type'Last - Parametrization_Type'First) / Base_Real_Type(Control_Points'Length - 1);
Numentator : Base_Real_Type := 1.0;
Denominator : Base_Real_Type := 1.0;
begin
for M in Control_Points'Range loop
if M /= J then
Numentator := Numentator * ( T - Interpolation_Nodes(M) );
Denominator := Denominator * ( Interpolation_Nodes(J) - Interpolation_Nodes(M) );
end if;
end loop;
return Numentator / Denominator;
end Eval_Basis_Poly;
begin
for I in Control_Points'Range loop
Result := Result + Control_Points(I) * Eval_Basis_Poly(I);
end loop;
return Result;
end Eval_Lagrange;
function Make_Equidistant_Nodes( N : Positive ) return Interpolation_Nodes_Array is
D : constant Base_Real_Type := (Parametrization_Type'Last - Parametrization_Type'First) / Base_Real_Type(N - 1);
Res : Interpolation_Nodes_Array(1..N);
begin
Res(Res'First) := Parametrization_Type'First;
if N /= 1 then
for I in Res'First + 1 .. Res'Last - 1 loop
Res(I) := Parametrization_Type'First + D * Base_Real_Type(I-1);
end loop;
Res(Res'Last) := Parametrization_Type'Last;
end if;
return Res;
Function Definition: procedure Draw_Help_Overlay is
Function Body: begin
if Font_Loaded then
GL.Toggles.Enable(GL.Toggles.Blend);
GL.Blending.Set_Blend_Func(GL.Blending.Src_Alpha, GL.Blending.One_Minus_Src_Alpha);
declare
Token : Gl.Immediate.Input_Token := GL.Immediate.Start (Quads);
begin
Gl.Immediate.Set_Color (GL.Types.Colors.Color'(0.1, 0.1, 0.1, 0.9));