is vertex visible ?

Blitz3D Forums/Blitz3D Programming/is vertex visible ?

Thanks, the method works, but I find it difficult to determine if a vector is pointing towards the camera.
 	;setup graphics
	Graphics3D 800, 600, 0, 2
	SetBuffer BackBuffer()
	
	WireFrame 1

	camera = CreateCamera()
	MoveEntity camera, 0, 0, -15
	
	campiv = CreatePivot()
	EntityParent camera, campiv
	
	cube = CreateCube()
	UpdateNormals cube
	surf = GetSurface(cube, 1)
	
	Repeat
		
		;turn camera
		TurnEntity campiv, 0, 1, 0
		RenderWorld
		
		;loop through all vertices	
		For i = 0 To CountVertices(surf) - 1


			TFormPoint VertexNX(surf, i), VertexNY(surf, i), VertexNZ(surf, i), cube, 0
			nx# = TFormedX() - EntityX(cube, 1) + EntityX(camera, 1)
			ny# = TFormedY() - EntityY(cube, 1) + EntityY(camera, 1)
			nz# = TFormedZ() - EntityZ(cube, 1) + EntityZ(camera, 1)
			TFormPoint nx, ny, nz, 0, camera
			
			test = TFormedZ() <= 0
			
			If test Then
							
				;draw normals
				TFormPoint VertexX(surf, i), VertexY(surf, i), VertexZ(surf, i), cube, 0
				CameraProject camera, TFormedX(), TFormedY(), TFormedZ()
				
				;project vertex position			
				vx# = ProjectedX()
				vy# = ProjectedY()
				TFormPoint VertexX(surf, i) + VertexNX(surf, i), VertexY(surf, i) + VertexNY(surf, i), VertexZ(surf, i) + VertexNZ(surf, i), cube, 0
	
				;project normal direction from vertex position
				CameraProject camera, TFormedX(), TFormedY(), TFormedZ()				
				nx# = ProjectedX()
				ny# = ProjectedY()
				
				;draw normal			
				Color 255, 0, 0
				Line vx, vy, nx, ny
				
			End If
							
		Next
								
		Flip
		
	Until KeyHit(1)
	
	End

When I turned on WireFrame modus, I realised the common culling is done by checking if a triangle is either clockwise or counter-clockwise. So I think I should give that a try.