fguihen Posted January 2, 2005 Posted January 2, 2005 minB->x=maxB->x=obb[0].x; i need to know how to phrase the above line in c#. also, does anyone know what the assert() method does? Quote
Administrators PlausiblyDamp Posted January 2, 2005 Administrators Posted January 2, 2005 would it be possible to post a bit more code? Without knowing what minB, maxB and oob are it is very hard to translate the code... Assert evaluates whatever is passed in to either a true or a false - if it equates to false then it kicks out an error message and prompts to debug when compiled in debug mode; In release mode assert doesn't do anything. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
fguihen Posted January 2, 2005 Author Posted January 2, 2005 minB and maxB are DirectX.Direct3D.Vector3 objects. obj[] is an array containing Vector3 objects. the entire c++ method i need to translate to c# is below. thanks : void CalcAABBFromOBB(const D3DXVECTOR3 *obb,D3DXVECTOR3 *minB,D3DXVECTOR3 *maxB) { assert(minB); assert(maxB); assert(obb); minB->x=maxB->x=obb[0].x; minB->y=maxB->y=obb[0].y; minB->z=maxB->z=obb[0].z; for (int i=1;i<8;i++) { if (obb.x < minB->x) minB->x=obb.x; if (obb.x > maxB->x) maxB->x=obb.x; if (obb.y < minB->y) minB->y=obb.y; if (obb.y > maxB->y) maxB->y=obb.y; if (obb.z < minB->z) minB->z=obb.z; if (obb.z > maxB->z) maxB->z=obb.z; } } Quote
Administrators PlausiblyDamp Posted January 2, 2005 Administrators Posted January 2, 2005 Not tested it but it should at least compile ;) void CalcAABBFromOBB(Microsoft.DirectX.Vector3[] obb, Microsoft.DirectX.Vector3 minB,Microsoft.DirectX.Vector3 maxB) { System.Diagnostics.Debug.Assert(obb != null); minB.X =maxB.X = obb[0].X; minB.Y =maxB.Y = obb[0].Y; minB.Z =maxB.Z = obb[0].Z; for (int i=1;i<8;i++) { if (obb[i].X < minB.X) minB.X=obb[i].X; if (obb[i].X > maxB.X) maxB.X=obb[i].X; if (obb[i].Y < minB.Y) minB.Y=obb[i].Y; if (obb[i].Y > maxB.Y) maxB.Y=obb[i].Y; if (obb[i].Z < minB.Z) minB.Z=obb[i].Z; if (obb[i].Z > maxB.Z) maxB.Z=obb[i].Z; } } Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
fguihen Posted January 2, 2005 Author Posted January 2, 2005 thank you very much for your help. your a real asset to the forum. thanks for all the replies Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.