Problem with UV calculation for procedual CubeSphere

Hello, i have problem with my UV calculation for a procedual CubeSphere.


there is a part where the UV are strange

and this is the c++ part for the UV calculation:

FVector2D AProcedualSphere::PointOnSphereToUV(FVector p)
{
	p.Normalize();
	
	float longitude = FMath::Atan2(p.X, -p.Y); 
	float latitude = FMath::Asin(-p.Z);

	const float pi = 3.14159f;
	float u = (longitude / pi + 1) / 2;
	float v = latitude / pi + 0.5f;

	
	return FVector2D(u,v);
}

i hope someone can help me