Combines Scale and Normalize passes and establishes constants for scaling
This commit is contained in:
parent
e6dd3c106a
commit
7878a18e17
18
src/tess.adb
18
src/tess.adb
|
@ -10,6 +10,8 @@ procedure Tess is
|
||||||
use Ada.Text_IO;
|
use Ada.Text_IO;
|
||||||
Info : Dtm_Info;
|
Info : Dtm_Info;
|
||||||
Input : File_Type;
|
Input : File_Type;
|
||||||
|
Minimum_Thickness : constant := 2.0;
|
||||||
|
Z_Scaling_Value : constant := 100;
|
||||||
begin
|
begin
|
||||||
Ada.Text_IO.Put_Line("Tess started.");
|
Ada.Text_IO.Put_Line("Tess started.");
|
||||||
Open(Input, In_File, "sample-data/katie.dat");
|
Open(Input, In_File, "sample-data/katie.dat");
|
||||||
|
@ -37,19 +39,23 @@ begin
|
||||||
end loop;
|
end loop;
|
||||||
end Scale;
|
end Scale;
|
||||||
|
|
||||||
procedure Normalize(Data : in out Dtm_Data) is
|
procedure Pad(Data :in out Dtm_Data) is
|
||||||
Max_Val : Dtm_Value := Max(Data);
|
|
||||||
begin
|
begin
|
||||||
Scale(Data, Dtm_Value(1) / Max_Val);
|
for Element of Data loop
|
||||||
end Normalize;
|
Element := Element + Minimum_Thickness;
|
||||||
|
end loop;
|
||||||
|
end;
|
||||||
|
|
||||||
Data : Dtm_Data(1..Info.Get_X, 1..Info.Get_Y);
|
Data : Dtm_Data(1..Info.Get_X, 1..Info.Get_Y);
|
||||||
Triangles : Dtm.Surface.Surface_Vector;
|
Triangles : Dtm.Surface.Surface_Vector;
|
||||||
|
Normalize_and_Scale_Factor : Dtm_Value;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Dtm.Katie.Get_Data(Data, Input);
|
Dtm.Katie.Get_Data(Data, Input);
|
||||||
Normalize(Data);
|
Normalize_and_Scale_Factor :=
|
||||||
Scale(Data);
|
Dtm_Value(Dtm_Value(1) / Max(Data)) * Dtm_Value(Z_Scaling_Value);
|
||||||
|
Scale(Data, Normalize_and_Scale_Factor);
|
||||||
|
Pad(Data);
|
||||||
Triangles.Reserve_Capacity(Count_Type(Dtm.Surface.Triangle_Count(Info)));
|
Triangles.Reserve_Capacity(Count_Type(Dtm.Surface.Triangle_Count(Info)));
|
||||||
Dtm.Surface.Surface_From_Grid(Triangles, Data);
|
Dtm.Surface.Surface_From_Grid(Triangles, Data);
|
||||||
Stl.Write(Triangles, "Farts.stl");
|
Stl.Write(Triangles, "Farts.stl");
|
||||||
|
|
Loading…
Reference in New Issue