Hi oompa,

comparing floating point numbers using an equals symbol is always
risky, especially since your value for 2*pi is already rounded off to
3 decimal places. You should use:

2.0 * Math.PI

since it does not suffer from rounding errors.

However, even then you'll run into problem with = (equals). You need
to define a threshold tolerance for your computation, that's the only
way you'll get rid of binary noise:

If (Math.Abs(pieValues(j + (i * 6)) < 1e-32)) Then

and

Else If (Math.Abs(pieValues(j + i * 6) - (2.0 * Math.Pi)) < 1e-32)
Then

--
David Rutten
da...@mcneel.com
Robert McNeel & Associates



On Mar 30, 12:12 am, oompa_l <gbrl.fr...@gmail.com> wrote:
> OK. well i figured it out but just aminor question. My values which
> represent a full circle (360 degree or 6.283 rad) are not agreeable to
> the function David wrote. I put in a conditional that if this value is
> encountered to make a circle, but this isn't working either...is there
> something wrong with my syntax?
>
>         If pieValues(j + (i * 6)) = 0.0 Then
>           'skip zero area segments.
>
>   Else If pieValues(j + (i * 6)) = 6.283 Then
>
>           Dim pie As OnCircle
>           pie.Create(P(i), 25.0)
>
>           graph.Add(pie)
>
>         Else
>           Dim pie As OnPolyCurve = PieSegment(P(i), angle0, pieValues
> (j + (i * 6)), 25)
>           graph.Add(pie)
>
>           'For k As int32 = 0 To angles.Count - 1
>           Dim color As New Double
>           color = j * 0.15
>           colors.Add(color)
>         End If
>
>         angle0 += pieValues(j + (i * 6))
>       Next

Reply via email to