cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Function problem

Yuradi
5-Regular Member

Function problem

Greetings.


I can not get my "Ncoor" function to work, his work is the same as the program on the right (which has "x3i y3i" as a result), but I can not store the result in "x4i y4i" (as seen in the sheet ).

In summary what is expected is that the vectors x3, y3 should be equal to x4, y4 (as verification), but made with a function, where the value of "af" can change.

 

As well:
The program is used to find the coordinates of a figure given a line (given by the value "af") that cuts the figure from above, the problem is that I never get the first point (0,0) that should be (0.263, 0.7) m, for this case of coordinates, and for any case of coordinates it takes the value of the last point.

 

Only those two questions, thank you.Smiley Happy

1 ACCEPTED SOLUTION

Accepted Solutions

And here is a problem which should let you think about the algorithm you implemented.

View solution in original post

5 REPLIES 5
Werner_E
24-Ruby V
(To:Yuradi)

In a program you don't use ranges but for-loops.

See if the attached helps.

This should solve the problem with the first, hard coded, point.

And here is a problem which should let you think about the algorithm you implemented.

Yuradi
5-Regular Member
(To:Werner_E)

I fixed it, with the considerations you gave me (I hope you do not have any errors now), thank you very much

Werner_E
24-Ruby V
(To:Yuradi)

You probably only fixed the error with the hard coded start coordinates (which were also missing the units) but not the problem which I drew attention to in my last post.

Look what still happens if you change the last argument to something like 65 cm. The green lines should be there, but aren't.

B.jpg

I attach two possible solution which you may adopt to your needs. I have chosen a matrix as file format for the polygon rather than separate x, y vectors and the height argument is measured from the bottom, not from the top. But all this can easily be changed to your needs.

B2.jpg

Top Tags