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;
|
||||
Info : Dtm_Info;
|
||||
Input : File_Type;
|
||||
Minimum_Thickness : constant := 2.0;
|
||||
Z_Scaling_Value : constant := 100;
|
||||
begin
|
||||
Ada.Text_IO.Put_Line("Tess started.");
|
||||
Open(Input, In_File, "sample-data/katie.dat");
|
||||
|
@ -37,19 +39,23 @@ begin
|
|||
end loop;
|
||||
end Scale;
|
||||
|
||||
procedure Normalize(Data : in out Dtm_Data) is
|
||||
Max_Val : Dtm_Value := Max(Data);
|
||||
procedure Pad(Data :in out Dtm_Data) is
|
||||
begin
|
||||
Scale(Data, Dtm_Value(1) / Max_Val);
|
||||
end Normalize;
|
||||
for Element of Data loop
|
||||
Element := Element + Minimum_Thickness;
|
||||
end loop;
|
||||
end;
|
||||
|
||||
Data : Dtm_Data(1..Info.Get_X, 1..Info.Get_Y);
|
||||
Triangles : Dtm.Surface.Surface_Vector;
|
||||
Normalize_and_Scale_Factor : Dtm_Value;
|
||||
|
||||
begin
|
||||
Dtm.Katie.Get_Data(Data, Input);
|
||||
Normalize(Data);
|
||||
Scale(Data);
|
||||
Normalize_and_Scale_Factor :=
|
||||
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)));
|
||||
Dtm.Surface.Surface_From_Grid(Triangles, Data);
|
||||
Stl.Write(Triangles, "Farts.stl");
|
||||
|
|
Loading…
Reference in New Issue