<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>
<DIV><FONT face=Arial color=#0000ff size=2>Hi!</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2>I'm not sure I understood your
problem...</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2>I imagine you have something like
this:</FONT></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV><FONT color=#0000ff size=2>float</FONT><FONT size=2> j =
0.8983f;</FONT></DIV>
<DIV><FONT color=#0000ff size=2>int</FONT><FONT size=2> i = (</FONT><FONT
color=#0000ff size=2>int</FONT><FONT size=2>)j;</DIV></BLOCKQUOTE></FONT>
<DIV><FONT face=Arial color=#0000ff size=2>making i=0.</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2>If you're using .NET you can use
the Math::Round method:</FONT></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV><FONT color=#0000ff size=2>float</FONT><FONT size=2> j =
0.8983f;</FONT></DIV>
<DIV><FONT color=#0000ff size=2>int</FONT><FONT size=2> i = (</FONT><FONT
color=#0000ff size=2>int</FONT><FONT
size=2>)Math::Round(j);</FONT></DIV></BLOCKQUOTE>
<DIV><FONT face=Arial color=#0000ff size=2>making i=1.</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2>Hope this helps!</FONT><BR></DIV>
<DIV><A href="http://www.inegi.up.pt"><IMG
src="http://inegi.inegi.up.pt/varios/assinatura2/individual/612.jpg"
border=0></A> <!--/td>
                        </tr>
                </table--></DIV></DIV><BR><BR><BR>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=fcukered@gmail.com href="mailto:fcukered@gmail.com">Ali Calvert</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=vtkusers@vtk.org
href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, July 18, 2006 5:33
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [vtkusers] Float to Int</DIV>
<DIV><BR></DIV>
<DIV>Hi all, i'm having a bit of difficulty converting my texture coordinates
(as a float from 0 -> 1) to a coordinate (as an integer from 0 - > size
of image) My current method simply floors the float, i.e. 0.8983 would
be a 0, however this isn't very accurate as it should be a 1. </DIV>
<DIV> </DIV>
<DIV>Can anybody help me please?</DIV>
<DIV> </DIV>
<DIV>Also if there is a better way of doing this rather than rounding, i would
appreciate any comments.</DIV>
<DIV> </DIV>
<DIV>Thank you for your time.</DIV>
<P></P><BR></BLOCKQUOTE></BODY></HTML>