Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Vector3 EvaluateOnSphere(float r, float theta, float psi, float offsetTheta, float offsetPsi){
- Vector3 v = new Vector3(
- Mathf.Cos(2f*Mathf.PI*theta+offsetTheta)*Mathf.Sin(2f*Mathf.PI*psi+offsetPsi),
- Mathf.Cos(2f*Mathf.PI*psi+offsetPsi),
- Mathf.Sin(2f*Mathf.PI*theta+offsetTheta)*Mathf.Sin(2f*Mathf.PI*psi+offsetPsi)
- );
- return r * v;
- }
- Vector3 EvaluateDerivateSphere(float theta, float psi, float magTheta, float magPsi, float offsetTheta, float offsetPsi){
- Vector3 vtheta = new Vector3 (
- -Mathf.Sin (2f * Mathf.PI * theta + offsetTheta) * Mathf.Sin (2f * Mathf.PI * psi + offsetPsi),
- 0f,
- Mathf.Cos (2f * Mathf.PI * theta + offsetTheta) * Mathf.Sin (2f * Mathf.PI * psi + offsetPsi)
- );
- vtheta.Normalize ();
- Vector3 vpsi = new Vector3 (
- Mathf.Cos (2f * Mathf.PI * theta + offsetTheta) * Mathf.Cos (2f * Mathf.PI * psi + offsetPsi),
- -Mathf.Sin (2f * Mathf.PI * psi + offsetPsi),
- Mathf.Sin (2f * Mathf.PI * theta + offsetTheta) * Mathf.Cos (2f * Mathf.PI * psi + offsetPsi)
- );
- vpsi.Normalize ();
- return magTheta * vtheta + magPsi * vpsi;
- }
Advertisement
Add Comment
Please, Sign In to add comment