is vertex visible ?

Blitz3D Forums/Blitz3D Programming/is vertex visible ?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Sorry for double-posting, but I found an algo in the archive (by birdie) that determines CW/CCW for a 2d triangle. And it works:
 	;setup graphics
	Graphics3D 800, 600, 0, 2
	SetBuffer BackBuffer()
	
	;enable wireframe	
	WireFrame 1

	;create camera	
	camera = CreateCamera()
	MoveEntity camera, 0, 0, -5
	
	;create pivot for camera	
	campiv = CreatePivot()
	EntityParent camera, campiv
	
	;create cube	
	cube = CreateCube()
	UpdateNormals cube
	surf = GetSurface(cube, 1)
	
	Repeat
		
		;turn camera
		TurnEntity campiv, 0, 1, 0
		RenderWorld
		
		;loop through all triangles		
		For i = 0 To CountTriangles(surf) - 1
		
			;get vertices from triangle			
			v0 = TriangleVertex(surf, i, 0)		
			v1 = TriangleVertex(surf, i, 1)
			v2 = TriangleVertex(surf, i, 2)
			
			;get coordinates from vertices
			v0x# = VertexX(surf, v0)
			v0y# = VertexY(surf, v0)
			v0z# = VertexZ(surf, v0)
			
			v1x# = VertexX(surf, v1)
			v1y# = VertexY(surf, v1)
			v1z# = VertexZ(surf, v1)
			
			v2x# = VertexX(surf, v2)
			v2y# = VertexY(surf, v2)
			v2z# = VertexZ(surf, v2)
			
			;project vertices to screen			
			CameraProject camera, v0x, v0y, v0z
			v0x# = ProjectedX()
			v0y# = ProjectedY()
							
			CameraProject camera, v1x, v1y, v1z
			v1x# = ProjectedX()
			v1y# = ProjectedY()
							
			CameraProject camera, v2x, v2y, v2z
			v2x# = ProjectedX()
			v2y# = ProjectedY()
			
			;check if triangle is CW			
			If ((v0x - v1x) * (v2y - v1y) - (v0y - v1y) * (v2x - v1x)) < 0 Then
				
				;if it is, draw vertices
				Color 255, 0, 0
				Oval v0x - 1, v0y - 1, 3, 3
				Oval v1x - 1, v1y - 1, 3, 3
				Oval v2x - 1, v2y - 1, 3, 3
				
			End If
			
		Next
							
		Flip
		
	Until KeyHit(1)
	
	End


Still, it is not exactly what I want. I think I should try projecting every triangle, and then checking if the projected vertex coordinate is behind any of the triangles from the cameras view.