[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Difficulty with createLine
From: |
Juan Pablo Carbajal |
Subject: |
Re: Difficulty with createLine |
Date: |
Thu, 2 Jun 2016 23:28:26 +0200 |
On Thu, Jun 2, 2016 at 10:41 PM, Thomas D. Dean <address@hidden> wrote:
> I have two scripts that create lines, using the same data, but different
> calls and I get different lines when I think I should be getting the same
> line.
>
> The first set of data comes from a complicated calculation.
>
> octave:1027> relTgtPosit
> relTgtPosit =
>
> 95.0000 16.0000
> 80.2279 -3.8953
> 65.4558 -23.7906
> 53.4611 -31.3488
> 29.4717 -46.4653
> 5.4823 -61.5818
> relTgtLeg =
> createLine([relTgtPosit(1,:),relTgtPosit(3,:);relTgtPosit(3,:),relTgtPosit(6,:)])
>
> The second set of data comes from direct assignment
>
> T1 = [95.0000 16.0000]
> T2 = [80.2279 -3.8953]
> T3 = [65.4558 -23.7906]
> lineT = createLine(T1,T3);
>
> figure; hold on; axis([0 120 -80 20]);
> grid
> drawLine(relTgtLeg(1,:), 'color', 'b')
> drawLine(lineT, 'color', 'c')
> hold off
>
> I think the two lines, relTgtLeg(1,:) and lineT should be the same.
>
> What am I doing wrong?
>
> Tom Dean
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-octave
I think you need to read the help of createLine carefully, I cite:
L = createLine(LINE); where LINE is an array of 4 values, creates
the line going through the point (LINE(1) LINE(2)), and with
direction given by vector (LINE(3) LINE(4)).
This is what you are using to build relTgLeg(1,:). So the lines goes
through [95, 16] with direction [65.4558 , -23.7906]
For lineT you use
L = createLine(p1, p2); Returns the line going through the two
given points.
so a line that goes thought [95, 16] and [65.4558 , -23.7906]. Thse
two are clearly not the same line. You can create lineT doing
lineT = createLine([T1,T3]);
and you will get the same line as relTgLeg(1,:).