Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › [Java] Triangle - Ray intersection test failing
New Posts  All Forums:Forum Nav:

[Java] Triangle - Ray intersection test failing

post #1 of 5
Thread Starter 
I cannot figure out why this will not work. It is part of a bukkit plugin for minecraft but that's besides the point. I generate the convex hull of a random set of points and store that in a triangle set. For each triangle i test the ray from a given point in a random direction. If the number of intersections is odd it is inside. Or that's how it is supposed to work. Relevant classes:

https://github.com/elBukkit/elRegion...va/quickhull3d (Tested working)

https://github.com/elBukkit/elRegion...olyhedron.java

https://github.com/elBukkit/elRegion...on/shapes/geom
Main
(18 items)
 
  
CPUMotherboardGraphicsGraphics
i7-4820 Gigabyte x79-UP4 MSI TF3 7950BE MSI TF3 7950BE 
RAMHard DriveHard DriveOptical Drive
Assorted Generic DDR3 1333 Sandisk Extreme SSD Random Assorted Crap Drives Random DVD-RW 
CoolingOSOSOS
H100 Arch Linux Windows 10 OSX 10.11 (15A244d) 
MonitorKeyboardPowerCase
HP x22LED 1080p G110 Antec HCG-750 Fractal Design Arc Midi 
  hide details  
Reply
Main
(18 items)
 
  
CPUMotherboardGraphicsGraphics
i7-4820 Gigabyte x79-UP4 MSI TF3 7950BE MSI TF3 7950BE 
RAMHard DriveHard DriveOptical Drive
Assorted Generic DDR3 1333 Sandisk Extreme SSD Random Assorted Crap Drives Random DVD-RW 
CoolingOSOSOS
H100 Arch Linux Windows 10 OSX 10.11 (15A244d) 
MonitorKeyboardPowerCase
HP x22LED 1080p G110 Antec HCG-750 Fractal Design Arc Midi 
  hide details  
Reply
post #2 of 5
You'll need to narrow down where the problem code is if possible, most people aren't going to be able to glance at an entire project and spot your problem without input data or some program to run.
Foldatron
(17 items)
 
Mat
(10 items)
 
Work iMac
(9 items)
 
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275 
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor 
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000 
PowerCase
750W PC P&C Silencer CoolerMaster 690 
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm 
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard 
Mouse
Mac wireless mouse 
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm 
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display 
Monitor
27" Apple thunderbolt display 
  hide details  
Reply
Foldatron
(17 items)
 
Mat
(10 items)
 
Work iMac
(9 items)
 
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275 
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor 
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000 
PowerCase
750W PC P&C Silencer CoolerMaster 690 
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm 
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard 
Mouse
Mac wireless mouse 
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm 
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display 
Monitor
27" Apple thunderbolt display 
  hide details  
Reply
post #3 of 5
Thread Starter 
Quote:
Originally Posted by lordikon View Post
You'll need to narrow down where the problem code is if possible, most people aren't going to be able to glance at an entire project and spot your problem without input data or some program to run.
Well i'm guessing the function in Triangle.java at Line 18 is where the problem lies:
https://github.com/elBukkit/elRegion...angle.java#L18
Main
(18 items)
 
  
CPUMotherboardGraphicsGraphics
i7-4820 Gigabyte x79-UP4 MSI TF3 7950BE MSI TF3 7950BE 
RAMHard DriveHard DriveOptical Drive
Assorted Generic DDR3 1333 Sandisk Extreme SSD Random Assorted Crap Drives Random DVD-RW 
CoolingOSOSOS
H100 Arch Linux Windows 10 OSX 10.11 (15A244d) 
MonitorKeyboardPowerCase
HP x22LED 1080p G110 Antec HCG-750 Fractal Design Arc Midi 
  hide details  
Reply
Main
(18 items)
 
  
CPUMotherboardGraphicsGraphics
i7-4820 Gigabyte x79-UP4 MSI TF3 7950BE MSI TF3 7950BE 
RAMHard DriveHard DriveOptical Drive
Assorted Generic DDR3 1333 Sandisk Extreme SSD Random Assorted Crap Drives Random DVD-RW 
CoolingOSOSOS
H100 Arch Linux Windows 10 OSX 10.11 (15A244d) 
MonitorKeyboardPowerCase
HP x22LED 1080p G110 Antec HCG-750 Fractal Design Arc Midi 
  hide details  
Reply
post #4 of 5
Quote:
Originally Posted by andrewq2 View Post
Well i'm guessing the function in Triangle.java at Line 18 is where the problem lies:
https://github.com/elBukkit/elRegion...angle.java#L18
Is it throwing an exception or just failing? If it's throwing an exception what does it say?
Foldatron
(17 items)
 
Mat
(10 items)
 
Work iMac
(9 items)
 
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275 
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor 
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000 
PowerCase
750W PC P&C Silencer CoolerMaster 690 
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm 
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard 
Mouse
Mac wireless mouse 
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm 
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display 
Monitor
27" Apple thunderbolt display 
  hide details  
Reply
Foldatron
(17 items)
 
Mat
(10 items)
 
Work iMac
(9 items)
 
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275 
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor 
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000 
PowerCase
750W PC P&C Silencer CoolerMaster 690 
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm 
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard 
Mouse
Mac wireless mouse 
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm 
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display 
Monitor
27" Apple thunderbolt display 
  hide details  
Reply
post #5 of 5
Thread Starter 
No exception, it just never works properly. I generate the convex hull properly, confirmed by exporting its data to a file and opening with blender. Then i make a triangles semi sure that is working. And it just leaves the ray intersection test failing.
Main
(18 items)
 
  
CPUMotherboardGraphicsGraphics
i7-4820 Gigabyte x79-UP4 MSI TF3 7950BE MSI TF3 7950BE 
RAMHard DriveHard DriveOptical Drive
Assorted Generic DDR3 1333 Sandisk Extreme SSD Random Assorted Crap Drives Random DVD-RW 
CoolingOSOSOS
H100 Arch Linux Windows 10 OSX 10.11 (15A244d) 
MonitorKeyboardPowerCase
HP x22LED 1080p G110 Antec HCG-750 Fractal Design Arc Midi 
  hide details  
Reply
Main
(18 items)
 
  
CPUMotherboardGraphicsGraphics
i7-4820 Gigabyte x79-UP4 MSI TF3 7950BE MSI TF3 7950BE 
RAMHard DriveHard DriveOptical Drive
Assorted Generic DDR3 1333 Sandisk Extreme SSD Random Assorted Crap Drives Random DVD-RW 
CoolingOSOSOS
H100 Arch Linux Windows 10 OSX 10.11 (15A244d) 
MonitorKeyboardPowerCase
HP x22LED 1080p G110 Antec HCG-750 Fractal Design Arc Midi 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › [Java] Triangle - Ray intersection test failing