I just need help urgently...
I've been trying averything for many days, but can't understand the issue.
Here is the code in which we get coefficients of plane equation
/////////////////////////////////////////////////code
static void ExtractPlanes() {

Transform t = new Transform();
Transform p = new Transform();

t.set(cameraTransform);
t.invert();
camera.setPerspective(90, ((float) eoaCanvas.width ) / ((float) eoaCanvas.height) , 0.1f, 20);
camera.getProjection(p);
p.postMultiply(t);

// Left clipping plane
p_planes[0].normal[0] = m[3] + m[0];
p_planes[0].normal[1] = m[7] + m[4];
p_planes[0].normal[2] = m[11] + m[8];
p_planes[0].d = m[15] + m[12];
// Right clipping plane
p_planes[1].normal[0] = m[3] - m[0];
p_planes[1].normal[1] = m[7] - m[4];
p_planes[1].normal[2] = m[11] - m[8];
p_planes[1].d = m[15] - m[12];
// Top clipping plane
p_planes[2].normal[0] = m[3] - m[1];
p_planes[2].normal[1] = m[7] - m[5];
p_planes[2].normal[2] = m[11] - m[9];
p_planes[2].d = m[15] - m[13];
// Bottom clipping plane
p_planes[3].normal[0] = m[3] + m[1];
p_planes[3].normal[1] = m[7] + m[5];
p_planes[3].normal[2] = m[11] + m[9];
p_planes[3].d = m[15] + m[13];
// Near clipping plane
p_planes[4].normal[0] = m[3] + m[2];
p_planes[4].normal[1] = m[7] + m[6];
p_planes[4].normal[2] = m[11] + m[10];
p_planes[4].d = m[15] + m[14];
// Far clipping plane
p_planes[5].normal[0] = m[3] - m[2];
p_planes[5].normal[1] = m[7] - m[6];
p_planes[5].normal[2] = m[11] - m[10];
p_planes[5].d = m[15] - m[14];
// Normalize the plane equations
NormalizePlane(p_planes[0]);
NormalizePlane(p_planes[1]);
NormalizePlane(p_planes[2]);
NormalizePlane(p_planes[3]);
NormalizePlane(p_planes[4]);
NormalizePlane(p_planes[5]);
}

static void NormalizePlane(CullingPlane plane) {
float mag;
mag = (float)Math.sqrt(plane.normal[0] * plane.normal[0] + plane.normal[1] * plane.normal[1] + plane.normal[2] * plane.normal[2]);
plane.normal[0] = plane.normal[0] / mag;
plane.normal[1] = plane.normal[1] / mag;
plane.normal[2] = plane.normal[2] / mag;
plane.d = plane.d / mag;
}
/////////////////////////////////////////////////////

Providing that camera is in the beginning of coordinates and directed to -Z, i.e. view matrix is single.
And fovy = 90. I get absolutely incorrect normals: they aren't perpendicular to each other, but they should be perpendicular
as if fovy = 90 planes must be perpendicular to each other.
As a result I get very narrow frustrum which apparantly doesn't show real cut planes, which look like screen.
Where is the mistake?


Second question:
Do I check object penetration (his limiting sphere into frustrum) correctly?
here is the code:
///////////////////////////////////////////////////////
// tests if a sphere is within the frustrum
static boolean ContainsSphere() {
// various distances
float fDistance = 0;
// calculate our distances to each of the planes
for(int i = 0; i < 6; i++) {
// find the distance to this plane
fDistance = dotProduct(p_planes[i].normal, sphereCenterWM)+p_planes[i].d;
if(fDistance < -sphereRadius){
return false;
}
// else if the distance is between +- radius, then we intersect
if((float)Math.abs(fDistance) < sphereRadius){
return true;
}
}
// otherwise we are fully in view
return true;
}
//////////////////////////////////////////////////////

At that, it is also interesting to know in which system of axes there should be a centre of the sphere?
Worldwide? Viewing?
For example, is it ok to do it this way:
sphereTransform.get(m);
sphereCenterWM[0] = m[3];
sphereCenterWM[1] = m[7];
sphereCenterWM[2] = m[11];