SRL Archive - Development

New DTM structures (pDTM is gone!)


mastaraymond

2010-05-19 16:54:34

So yes, the latest Simba uses a new structure for DTMs.

We got rid of the pDTM structure and created a new one.. It works like this; The 'DTM' itself is an Object called TMDTM. It has a few members (Like AddPoint).. And it holds an Array of TMDTMPoints.. (This is the actual DTM-information!)

The structure of a TMDTMPoint looks like this:

{
x,y : Coordinates;
c : Color;
t : Tolerance;
Asz: Area size;
bp: Bad Point;
}
TMDTMPoint = record //TMufasaDTMPoint
x,y,c,t,asz : integer;
bp : boolean;
end;

Now there is also support for DTM.ToString and DTMFromString with this new structure (the old dtm strings will still work!).

Here is a little testscript:

program new;
var
x : TMDTM;
y,xx,yy : integer;
str : string;
begin
x := TMDTM.create;
x.AddPoint(CreateDTMPoint(5,5,clwhite,5,0,true));
x.AddPoint(CreateDTMPoint(-5,-5,clwhite,30,5,false));
Writeln(format('Our DTM index is: %d',[x.index]));
str := x.ToString;
y := DTMFromString(str);
writeln(GetDTM(y).Count);
PrintDTM(GetDTM(y));
Writeln(format('The DTM index is: %d',[GetDTM(y).index]));
FindDTM(x.Index,xx,yy,0,0,50,50);
end.

Sir R. M8gic1an

2010-05-19 16:57:46

Only one BadPoint per DTM ?

~RM

nielsie95

2010-05-19 17:03:23

This doesn't seem right?


program new;
var
x : TMDTM;
begin
x := TMDTM.create;
x.AddPoint(CreateDTMPoint(5,5,clwhite,5,0,true));
x.AddPoint(CreateDTMPoint(-5,-5,clwhite,30,5,false));
Writeln(format('Our DTM index is: %d',[x.index]));

x := SDTMToMDTM(MDTMToSDTM(x));
Writeln(format('Our DTM index is: %d',[x.index]));
end.

From: Rasta Magician
Only one BadPoint per DTM ?

~RM


It's a boolean per point.

mastaraymond

2010-05-19 17:27:12

From: nielsie95
This doesn't seem right?


program new;
var
x : TMDTM;
begin
x := TMDTM.create;
x.AddPoint(CreateDTMPoint(5,5,clwhite,5,0,true));
x.AddPoint(CreateDTMPoint(-5,-5,clwhite,30,5,false));
Writeln(format('Our DTM index is: %d',[x.index]));

x := SDTMToMDTM(MDTMToSDTM(x));
Writeln(format('Our DTM index is: %d',[x.index]));
end.



It's a boolean per point.

Ah, nice one :)

E: Fixed.

marpis

2010-05-20 06:04:07

From: Rasta Magician
Only one BadPoint per DTM ?

~RM


Look it again :rolleyes:

x.AddPoint(CreateDTMPoint(5,5,clwhite,5,0,true));
x.AddPoint(CreateDTMPoint(-5,-5,clwhite,30,5,true));
There you have 2 bad points.

Sir R. M8gic1an

2010-05-20 06:42:08

From: marpis
Look it again :rolleyes:

x.AddPoint(CreateDTMPoint(5,5,clwhite,5,0,true));
x.AddPoint(CreateDTMPoint(-5,-5,clwhite,30,5,true));
There you have 2 bad points.


Nielsie had already clarified that, but thank you ;)

~RM

Avaphi

2010-05-20 12:05:17

DTM has been giving me lip ever since I started back using SCAR/Simba again - Would love to see it updated ! :)

Coh3n

2010-05-24 20:07:27

Is this the update that caused an unknown type for TDTMPointDef?

E: Nevermind, I didn't update SRL. :p

Nava2

2010-05-25 21:29:59

This was a great idea, but I'm not sure I like it more than the pdtm. I say this because its harder to manipulate than the pDTM, its a bit oop in a linear language.

Also, I think there dhould be a better FindDTM.

mastaraymond

2010-05-26 03:50:27

From: Nava2
This was a great idea, but I'm not sure I like it more than the pdtm. I say this because its harder to manipulate than the pDTM, its a bit oop in a linear language.

Also, I think there dhould be a better FindDTM.

Well, the pDTM had it's disadvantages. It was a record thus copied in memory the whole time, while these DTMs are stored in 1 place (the object). And yes, it's harder to manipulate.. But hey, I've never seen someone manipulate their DTMs after they loaded it :p