.NET Greater than/less than not working

Joe

I am having the issue of my greater than/less than comparison not working.

Here is what is happening:

Let's say I have a square, and I'm getting the minimum and maximum points of this square in space, ex. minPoint = (0,0,0) and maxPoint = (1,1,1)

I am placing text on this face but I need the text to be inside the square face, if it isn't then I reduce the size until it fits.

Here is my code after properly getting the distance of both the minPt to the maxPt, and also the minPt to the text location.

Here is my line of code that is not working:

If sizeYPt <= sizeY And sizeXPt <= sizeX Then Exit Do

It works for most situations but I have had situations where it won't work. One thing I noticed is that sizeYPt is the same as sizeY, and sizeXPt is smaller than sizeX (which should all be true!!! argh)

Anyone know what the issue could be? Here is my full code:

Dim sizeY, sizeX, sizeYPt, sizeXPt As Double
Dim yVect, xVect As New VISIVector

yVect.Put(0, 1, 0)
xVect.Put(1, 0, 0)

sizeY = Util.dist2pts_alongAxis(centerPoint, p2, yVect)
sizeYPt = Util.dist2pts_alongAxis(centerPoint, txtPt, yVect)
sizeX = Util.dist2pts_alongAxis(p1, p2, xVect)
sizeXPt = Util.dist2pts_alongAxis(p1, txtPt, xVect)

If sizeY.ToString.Contains("-") Then sizeY = sizeY * -1
If sizeYPt.ToString.Contains("-") Then sizeYPt = sizeYPt * -1
If sizeX.ToString.Contains("-") Then sizeX = sizeX * -1
If sizeXPt.ToString.Contains("-") Then sizeXPt = sizeXPt * -1

MsgBox(sizeYPt & " | " & sizeY & vbNewLine & sizeXPt & " | " & sizeX)

If sizeYPt <= sizeY And sizeXPt <= sizeX Then Exit Do
Joe

Floating point math is inexact, you need a "close enough" check. Use, say, If SizeYPt - SizeY <= 1E-12

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

php Greater Than Comparison Not Working

From Dev

Python greater than and less than operands not working?

From Dev

Data binding not working if index is greater than 255

From Dev

Why is "greater than" not working with char type?

From Dev

Greater than function in MATLAB not working as expected

From Dev

SQL - Greater than date query not working

From Dev

Javascript switch greater than / less than operators not working

From Dev

Greater than and Less than not working correctly with random number in Python

From Dev

Greater Than and Less Than in Column in Datagridview VB.Net

From Dev

Lanczos scale not working when scaleKey greater than some value

From Dev

Finding numbers greater than the average - why is my IF statement not working properly?

From Dev

Working with time values greater than 24 hours in R

From Dev

Mysql 'between' condition not working if value is greater than 9999 with varchar field

From Dev

Lanczos scale not working when scaleKey greater than some value

From Dev

if value of column 3 is greater than cap print it in tmp not working properly

From Dev

one-dimensional array in shell not working for indexes greater than 08

From Dev

Web audio stereo panner not working correctly if the volume is greater than 0

From Dev

Vb .net Error, No row in database greater than 0

From Dev

VB.NET: use "Or" with a "equal or greater than" in a "If" statement

From Dev

Greater than or Less than equal to

From Dev

if greater than or less than and zero

From Dev

sum if greater than in r

From Dev

'NOT GREATER THAN' condition Mysql

From Dev

Indexes for 'greater than' queries

From Dev

Javascript not greater than 0

From Dev

Not Greater Than Operator in Swift !>

From Dev

JS "Greater than" operator;

From Dev

Postgres greater than or null

From Dev

Postgres greater than or null

Related Related

  1. 1

    php Greater Than Comparison Not Working

  2. 2

    Python greater than and less than operands not working?

  3. 3

    Data binding not working if index is greater than 255

  4. 4

    Why is "greater than" not working with char type?

  5. 5

    Greater than function in MATLAB not working as expected

  6. 6

    SQL - Greater than date query not working

  7. 7

    Javascript switch greater than / less than operators not working

  8. 8

    Greater than and Less than not working correctly with random number in Python

  9. 9

    Greater Than and Less Than in Column in Datagridview VB.Net

  10. 10

    Lanczos scale not working when scaleKey greater than some value

  11. 11

    Finding numbers greater than the average - why is my IF statement not working properly?

  12. 12

    Working with time values greater than 24 hours in R

  13. 13

    Mysql 'between' condition not working if value is greater than 9999 with varchar field

  14. 14

    Lanczos scale not working when scaleKey greater than some value

  15. 15

    if value of column 3 is greater than cap print it in tmp not working properly

  16. 16

    one-dimensional array in shell not working for indexes greater than 08

  17. 17

    Web audio stereo panner not working correctly if the volume is greater than 0

  18. 18

    Vb .net Error, No row in database greater than 0

  19. 19

    VB.NET: use "Or" with a "equal or greater than" in a "If" statement

  20. 20

    Greater than or Less than equal to

  21. 21

    if greater than or less than and zero

  22. 22

    sum if greater than in r

  23. 23

    'NOT GREATER THAN' condition Mysql

  24. 24

    Indexes for 'greater than' queries

  25. 25

    Javascript not greater than 0

  26. 26

    Not Greater Than Operator in Swift !>

  27. 27

    JS "Greater than" operator;

  28. 28

    Postgres greater than or null

  29. 29

    Postgres greater than or null

HotTag

Archive