From: "ldries46" <bertus.dries@planet.nl>
Subject: Incorrect error?
Date: Mon, 18 Jul 2011 10:47:50 +0200
Date: 2011-07-18T10:47:50+02:00 [thread overview]
Message-ID: <4e23f350$0$2573$703f8584@news.kpn.nl> (raw)
I'm using Ada.Numerics.Generic_Real_Arrays. While Compiling I got the
following error message:
65:21 expected type "Ada.Numerics.Generic_Real_Arrays.Real_Vector" from
instance at line 6
65:21 found type "Ada.Numerics.Generic_Real_Arrays.Real_Matrix" from
instance at line 6
As can be seen Cross, a and b declared as Real_Vector .
What do I do wrong?
L. Dries
Code:
package Float_Arrays is new Ada.Numerics.Generic_Real_Arrays (float);
use Float_Arrays;
function Volume (ObjID : integer; Obj : ptrS_Object) return float is
ok : boolean;
n : integer := 1;
Volume : float;
a : Real_Vector(0 .. 2);
b : Real_Vector(0 .. 2);
X0 : Real_Vector(0 .. 2);
X1 : Real_Vector(0 .. 2);
X2 : Real_Vector(0 .. 2);
cross : Real_Vector(0 .. 2);
nA : Real_Vector(0 .. 2);
p : ptrNode_Object;
TempS : ptrS_Object;
TempT : ptrTriangle_Object;
begin
TempS := Obj;
while n /= ObjID loop
n := n + 1;
TempS := TempS.next;
if TempS = null then
declare
NO_NODE_OBJECT : exception;
begin
raise NO_NODE_OBJECT;
end;
end if;
end loop;
n := TempS.PosFaces(0);
TempT := stT_Object;
ok := TempT = null;
while not ok loop
if TempT.nr = n then
ok := true;
else
TempT := TempT.next;
ok := TempT = null;
end if;
end loop;
while n < TempS.PosFaces(1) loop
p := GetPoint(TempT.P1);
X0(0) := p.pRectangular(x);
X0(1) := p.pRectangular(y);
X0(2) := p.pRectangular(z);
p := GetPoint(TempT.P2);
X1(0) := p.pRectangular(x);
X1(1) := p.pRectangular(y);
X1(2) := p.pRectangular(z);
p := GetPoint(TempT.P3);
X2(0) := p.pRectangular(x);
X2(1) := p.pRectangular(y);
X2(2) := p.pRectangular(z);
a := X1 - X0; -- VecSub( a, X1, X0 );
b := X2 - X0; -- VecSub( b, X2, X0 );
Cross := a * b; -- VecCross( a, b, Cross );
<---------------- line 65 the cursor is standing just before *
nA := Cross * 0.5; -- VecMultScalar( nA, Cross, 0.5 );
-- Volume = Volume + fabs(VecDot( X0, nA ));
Volume := Volume + X0(0)*nA(0) + X0(1)*nA(1) + X0(2)*nA(2);
n := n + 1;
end loop;
Volume := Volume/3.0;
return Volume;
end Volume;
next reply other threads:[~2011-07-18 8:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-18 8:47 ldries46 [this message]
2011-07-18 9:45 ` Incorrect error? stefan-lucks
2011-07-18 10:10 ` Georg Bauhaus
2011-07-18 11:46 ` ldries46
2011-07-18 10:40 ` AdaMagica
2011-07-18 12:39 ` Dmitry A. Kazakov
2011-07-18 12:45 ` stefan-lucks
2011-07-18 13:24 ` stefan-lucks
2011-07-18 10:39 ` Nicholas Collin Paul de Glouceſter
2011-07-18 15:58 ` Adam Beneschan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox