Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

145 Neutral

About Gorwooken

  • Rank
  1. Gorwooken

    Circular Interpolation

    maybe someone can tell me if this makes sense i'd like to interpolate using distance rather than time so i'll solve for t so theres dtheta/dt = v/r + (aT/r)*t then theta = (v/r)*t + (aT/2r)*t^2 so now i'll assume i'm starting at a point on the circle so x = rcos((v/r)*t + (aT/2r)*t^2) y = rsin((v/r)*t + (aT/2r)*t^2) and (aT/2r)*t^2 + (v/r)*t - acos(x/r) = 0 (aT/2r)*t^2 + (v/r)*t - asin(y/r) = 0 and i take the positive root so if i start at (r, 0) on the circle and i rotate to (0, r) with v = 0 then t = sqrt((acos(x/r)*2r)/aT) t = sqrt((asin(y/r)*2r)/aT) now at (0, r) the velocty in x is Vtangential y is 0 if i swap the sin and the cos out when i pass 90 degrees (aT/2r)*t^2 + (Vtangential/r)*t - asin(x/r) = 0 (aT/2r)*t^2 + (Vtangential/r)*t - acos(y/r) = 0 then i continue to recalculate the tangential velocity and swap the sin/cos every 90 degrees, is this correct?
  2. Gorwooken

    Circular Interpolation

    in this particular problem i need to generate a set of values that will allow me to ramp up to a specific tangential velocity then maintain that velocity. i do agree that that would solve the problem if i wanted to look at it as a straight line but i don't i suppose i should have stated that this is a coordinated motion problem, i have a stepper motor controlling x, and one controlling y i can step s in a either direction along that axis i need to generate a list of times for each axis that when i step the motors at those intervals generates a circle
  3. Gorwooken

    Circular Interpolation

    I'm developing some software for driving stepper motors. I'm a little stuck on some of the math behind circular interpolation. I'm finished with linear interpolation and i went about that by using d=a/2t^2 i can move distance s every time i step so d = s*n where n is the number of steps i've taken. t = sqrt((s*n/a)*2) then my dt = sqrt((s*n/a)*2) - sqrt((s*(n-1)/a)*2). initially i looked into doing something similar with circular interpolation but since arctan isn't a 1 to 1 function i lost my way basically i want to start a v = 0 and accelerate at some tangential velocity aT, so the parametric forms for a circle are: x = a + rcos(theta) y = b + rsin(theta) and d^2theta/2t^2 = aT/r so theta = (aT*t^2)/(2*r) and we have x = a + rcos((aT*t^2)/(2*r)) y = b + rsin((aT*t^2)/(2*r)) now obviously if i wanted to solve for t the constraint on x is -r <= x <= r and this is where my problem lies i need to be able to incorporate the rotation. ie i start at r and move to -r on the x axis, but if i want to go from -r to r then to 0 i don't know how to express that. my current implementation interpolates using t then calculates the change in position if that is >= to my step distance, i use that delta t. this feels very inefficient but it does seem to work, is there a more elegant solution?
  4. Gorwooken

    IN and OUT

    i've been playing around with some driver development for windows. I've noticed a few issues with IN and OUT. Currently just for my own amusement i'm working on serial port driver that communicates with the UART chip on port 0x3F8 (com 1). I've noticed that when I run my driver anything i read from the registers returns 0xFF unless something in windows has an open handle to a serial port in which case it returns the proper value of what i wrote to it. Also I've noticed that i can't set PIC masks on port 0x21, i can only ever read back 0 from there ( all interrupts enabled ). I've done some interfacing with an APIC before and I've had no issues working with interrupt masks. Is there an ability to disable access to certain ports that I'm unaware of? I'm just looking for an explanation.
  5. Gorwooken

    FSB Frequency

    I was hoping it was stored somewhere in windows but i decided to just calculate it when my driver launches. If anyone is interested I use QueryPerformanceCounter to calculate the time it takes for the APIC timer to count down from 0xFFFFF to 0 at the bus' frequency. I then calculate the FSB freq. I'm still open to other ideas if there are any.
  6. I'm working on a windows driver that enables and and installs an interrupt handler for a cpu's local APIC timer. According to the intel manual the apic timer freq is derived from the FSB frequency so I'm looking for a way to obtain that freq in windows. any suggestions would be appreciated.
  7. If you want to play the mp3 in the default windows mp3 player, you should use ShellExecute It performs the same function as if you were to type something into Start->Run
  8. Gorwooken

    Arrays in C

    I'm working on some software for a motorola processor and i'm developing it in C. I'm trying to keep my code as small and maintainable as possible. Currently I'm implementing a circular buffer, however I'd like to be able to store any datatype in this buffer. I was thinking of doing something like this: typedef struct { void *pData; word ReadLoc; word WriteLoc; word nElements; word nSize; size_t nWidth; } CBUFFER; bool buffer_write(CBUFFER* pBuffer, void *pData) { //if space is avail word nWidth = pBuffer->nWidth; if(pBuffer->nElements < pBuffer->nSize) { memcpy(((byte*)pBuffer->pData)[nWidth*pBuffer->WriteLoc], pData, nWidth); pBuffer->nElements++; pBuffer->WriteLoc++; // check to see if out of bounds, set to 0 if it is return TRUE; } // no space return FALSE; } CBUFFER* buffer_create(word nSize, size_t nWidth) { CBUFFER *pBuffer = (CBUFFER*)malloc(sizeof(CBUFFER)); if(pBuffer) { memset(pBuffer, 0, sizeof(CBUFFER)); pBuffer->nWidth = nWidth; pBuffer->nSize = nSize; pBuffer->pData = malloc(nSize*nWidth); if(pBuffer->pData) return pBuffer; free(pBuffer); } return NULL; } void main() { somedatatype data = something; CBUFFER *pBuffer = buffer_create(60, sizeof(somedatatype)); buffer_write(pBuffer, data); // and so on.... } I just wrote that up so don't bother checking for syntax, I also may change the create function to take a pointer to a CBUFFER structure so i can allocate the structure on the stack if i want to. Other operations would be implemented in a similar way. I was just wondering if there are any better ways to go about doing this?
  9. I've been developing a multitasking operating system for a 16 bit motorola processor, everything so far is going well, the software task switching works and is stable. Now I'm looking for a way to get information from an interrupt to running processes. I need to do the least amount of work in the interrupt itself, just unload the data somewhere. I was thinking about passing messages off to a circular buffer in the kernel and allowing the kernel to process the messages and pass them off to processes when it gets cpu time. I want messages to have a priority aswell, what would the fastest way to go about this? just use a circular buffer for each priority level and empty them out based on priority?
  10. Gorwooken

    Singleton Help!

    You don't really need to use a singleton, you could just pass it like this Just pseudo code class Path{ public: Path(Print *print); ~Path(); SetPath(); .... .... Print *m_pPrint; }; Path::Path(Print *print) { m_pPrint = print; } Path::SetPath() { ...... m_pPrint->Error(); ...... } Print g_print; void main() { Path path(&g_print); path.Print; } or you could just access the global from the constructor Path::Path() { m_pPrint = &g_print; }
  11. Gorwooken

    Please point me a good 'GJK algorithm' article

    I've read through ginos material. Most of it was straight forward, it helped me do the implementation for penetration depth. I wrote the algorithm out a few months ago, still a couple of bugs I need to sort out I just haven't had the time. I had previously done an implementation of GJK for separating distance based off Christer's articles which are by far the best out there.
  12. Gorwooken

    Tiling sides of 3D triangle

    If I understand you correctly you simply want to create a wedge with 6 vertices. When you say 3 quads high and 5 deep I'm a little unsure of what you want. If you always want it to be a simple ramp you'll only ever need 3 quads and 2 tris. if you want to create a ramp thats 3 units high and 5 units deep i'd suggest beginning at the origin for simplicity. Create a vertex at the orign, create another 5 units along the x axis and another 5 units above that so you have 3 verts. (0, 0, 0), (5, 0, 0), (5, 0, 3) now offset these along the y axis by the width you want (0, W, 0), (5, W, 0), (5, W, 3) and create 2 tris using each of those set of points(sides) and the rest can be quads.
  13. Well i'm pretty sure the compiler will truncate x = 260 and after the truncation you'll be left with x equal to 4. unsigned char is one byte and you've got 260 which is 100000100 in binary since one byte represents 8 bits a truncation will leave you with 00000100 which is 4, then you shift 4 to the left twice, 16, then you and 16 with 15, resulting in zero and the not of zero is one. The code "works" but you realy shouldn't be assigning numbers to data types that can't store them.
  14. Gorwooken

    Penetration Depth

    I'm having a couple issues when it comes to my function layout in terms of building these triangles, I'm breaking most of it up into cases. Say the point on the sum in the direction of closest point on the face of the triangle returns as one of the vertices of the initial triangle. I'll end up building degenerate triangles. I'm trying to avoid this. I've got 2 main cases set up, one if the above is true, if its false I take another path that checks if any of the points found on the sum in the direction of the closest point on the edge lie on a vertex of the initial triangle. I'm worried that this is a little excessive. I've finished an implementation of the GJK algorithm for computing separating distance. I've noticed numerical imprecision as the distance between objects gets very large but generally I use SAT with OBBs to determine if two objects could possibly be intersecting then switch to GJK as a second test. For the most part it gives me fairly good results.
  15. Gorwooken

    Penetration Depth

    I'm still a little stuck on this, I'm unsure of what to do with the face of the triangle I'm splitting. I've got something working but its somewhat unstable at the moment I'm not sure on how to terminate the algorithm.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!