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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

odd result when plotting offset circle

relayman357
9-Granite

odd result when plotting offset circle

This isn't urgent, I'm just curious here, but in the attached Prime 8.0 file I'm plotting an offset circle in steps from 0° to 360°.  When I reduce the resolution by going to 10° steps I get the interesting figure on the right.  Why is that happening?  

 

 

Picture1.png

1 ACCEPTED SOLUTION

Accepted Solutions

1) In your sheet you set line style to "none" so we possibly won't see what your picture shows.

 

2) You don't show HOW you would manage a step width of 10°. If you do it correctly, you will see exactly what you expect.
Here with Line Style set to full line:

Werner_E_0-1700431053022.png

I guess you just used

Werner_E_1-1700431102758.png

which would explain what you posted.

That way there still is created a vector with 361 elements!!

Werner_E_2-1700431294328.png

But only elements #0,10,20,... get the values you intend, the rest is filled with zeros by default.

 

You may consider using something like

Werner_E_3-1700431609568.png

 

or

 

Werner_E_5-1700431946644.png

 

A less "legal" but convenient way uses the undocumented (and so unreliable) trick that an inline evaluation turns a range into a vector

Werner_E_0-1700432595775.png

Don't try to set the unit deg at the result - it will throw an error.

 

 

 

View solution in original post

3 REPLIES 3

1) In your sheet you set line style to "none" so we possibly won't see what your picture shows.

 

2) You don't show HOW you would manage a step width of 10°. If you do it correctly, you will see exactly what you expect.
Here with Line Style set to full line:

Werner_E_0-1700431053022.png

I guess you just used

Werner_E_1-1700431102758.png

which would explain what you posted.

That way there still is created a vector with 361 elements!!

Werner_E_2-1700431294328.png

But only elements #0,10,20,... get the values you intend, the rest is filled with zeros by default.

 

You may consider using something like

Werner_E_3-1700431609568.png

 

or

 

Werner_E_5-1700431946644.png

 

A less "legal" but convenient way uses the undocumented (and so unreliable) trick that an inline evaluation turns a range into a vector

Werner_E_0-1700432595775.png

Don't try to set the unit deg at the result - it will throw an error.

 

 

 

Thank you Werner!

 

1) Yes, sorry - I forgot to mention I changed i:=0,1..360 to i:=0,10..360 to go to 10 degree steps.

 

2) I didn't know i:0,10..N still produced N+1 elements. I thought it would produce N/10.

 

That undocumented trick is very interesting.  

 

Thank you for getting me back on track!


 

2) I didn't know i:0,10..N still produced N+1 elements. I thought it would produce N/10.

 

 


The range "values" (actually a range is kind of an implicit loop) are used to address the vector elements.

If the range ist defined as i:=0,10..N and you assign v[i := ..., then you assign values to vector element #0, #10, #20, .... and the elements with other numbers like #3 oder #12 are left undefined and so Prime sets them to zero. You can't expect that with i=10 Prime assign the value to vector element #1.

When you write v[20:=123 you create a vector with 21 elements. element #20 holds the value 123 and the elements from #0 to #19 are set to 0.

Top Tags