From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,STOX_REPLY_TYPE, STOX_REPLY_TYPE_WITHOUT_QUOTES,XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ad3b8638a6e09884,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder.news-service.com!feeder.news-service.com!feed.xsnews.nl!border-3.ams.xsnews.nl!upload-1.xsnews.nl!10.10.69.15.MISMATCH!frontend-F09-15.ams.news.kpn.nl From: "ldries46" Newsgroups: comp.lang.ada Subject: Incorrect error? Date: Mon, 18 Jul 2011 10:47:50 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Newsreader: Microsoft Windows Live Mail 15.4.3508.1109 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3508.1109 Message-ID: <4e23f350$0$2573$703f8584@news.kpn.nl> Organization: KPN.com NNTP-Posting-Host: 77.168.179.107 X-Trace: 1310978896 news.kpn.nl 2573 77.168.179.107@kpn/77.168.179.107:49507 Xref: g2news2.google.com comp.lang.ada:21183 Date: 2011-07-18T10:47:50+02:00 List-Id: 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;