Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 17 Jun 2005
Offline Last Active Feb 04 2014 09:46 AM

Topics I've Started

Equation of cone along an arbitrary axis

12 December 2012 - 02:37 PM

Hi all.

I'm looking for an equation for a cone along an arbitrary axis and I've run a few Google searches, but haven't come across much except for:

"Let V be the vertex, A be a unit vector in the direction of the axis of rotation, and B,C be unit vectors such that A,B,C are mutually orthogonal. Let theta be the angle between the cone and the axis.
To get to an arbitrary point on the cone, we start at P, travel a length of s along the axis (where s is an arbitrary real number), and then travel a distance of s*sin(theta) in any direction perpendicular to the axis. An arbitrary direction perpendicular to A has the form B*cos(t) + C*sin(t), where t runs from 0 to 2π.
Putting this together gives us a parametrization of:
P + s * A + s * sin(theta) * (B * cos(t) + C * sin(t))."

I'm not sure how this fits into what I'd like to do though. Specifically, I'm attempting to find a way to construct a cone such that its vertex is at point p = (px,py,pz) and the cone runs tangent to a sphere with origin o = (sx,sy,sz) and radius r. In other words, I want the cone to run along the axis defined by the vector o - p, with height equal to the length of said vector and its base have radius r.

This is not homework. I'm going to use the cone to construct a circle on a plane that intersects with the cone. I know that the conic section formed by the cone-plane intersection will not be a perfect circle - I'm just interested in an approximation.

Thanks in advance.

MS3D Viewer Control (Visual C#)

20 June 2011 - 09:55 PM

Hi all.

I am in the process of putting the finishing touches on a Milkshape3D viewer control for Visual C# and am looking for suggestions on features to add / improve. Its primary use is for game tools (such as editors). More information (including a feature list) regarding the control can be found here.

This is something I plan on releasing (soon) so that people can use it in their own projects, so any kind of feedback is greatly appreciated. Alternatively, you may also donate MS3D files for testing purposes (I'm a programmer, not an artist, so my collection is pretty sparse). Thanks!

SDL / XBOX 360 controller issue

14 February 2007 - 04:59 PM

I recently bought an XBOX 360 controller to use for my current project, but SDL doesn't seem to recognize that it is there. I used to use another gamepad (and it worked fine), but I want to switch over to the XBOX 360 controller. The XBOX controller is detected by any of the other games that I play on my PC, but specifically not in my own application (SDL_NumJoysticks() returns 0). Anyone else have a similar problem, and how did you fix it (if at all)?


17 January 2007 - 05:11 PM

The answer to this question must be obvious, but I can't seem to get my music to loop when played as a FSOUND_STREAM...
/* Defined inside RPG::MusicManager... */
FSOUND_STREAM *m_MusicData; /* Pointer to stream (duh) */

bool RPG::MusicManager::Create(const char *p_FileName, int p_Volume, int p_Loop)
  if((p_FileName == NULL) || (p_Volume < 0)) { return(false); }

  if(m_MusicData != NULL) { FSOUND_Stream_Close(m_MusicData); m_MusicData = NULL; }
  m_MusicData = FSOUND_Stream_Open(p_FileName, 0, 0, 0);
  if(m_MusicData == NULL) { return(false); }

  FSOUND_Stream_SetLoopCount(m_MusicData, p_Loop);
  FSOUND_Stream_Play(0, m_MusicData);
  FSOUND_SetVolumeAbsolute(0, p_Volume);

The music only plays once, despite specifying p_Loop to be -1 when I call the function. What's the problem? Any other suggestions are welcome as well. Thanks in advance.

Character Switch System (std::list Problem)

29 June 2006 - 10:46 AM

I'm trying to create a character switch system, but I seem to be having troubles mastering the std::list. Whenever the player presses PAGE_UP or PAGE_DOWN, the camera is supposed to switch focus to another player character (PC) in the list (the player can only control the PC that the camera is focusing on). However, with two PCs in the world, nothing happens... The camera will remain focused on PC 1 (as opposed to PC 2). And with three PCs, it can switch between PCs 1 and 2, but when PC 2 is in focus, you can control PC 1 as well!!
class cGamePC
    bool m_HasFocus;

    /* For sake of shortness, any member function that isn't used in the 
       following code is not included */

    bool ChangeFocus(bool p_Focus) { m_HasFocus = p_Focus; }
    bool Update() { /* PROCESS USER INPUT */ return(true); }

namespace RPG
  std::list<cGamePC *> PCList;

  void Update();

void RPG::Update()
  /* Update player characters */
  for(std::list<cGamePC *>::iterator x = PCList.begin(); x != PCList.end(); ++x)
    /* Check for key press (PLAYER SWITCH) */
    if((KEY->PAGEUP()) && (PCList.size() > 1))
      /* Switch focus to previous character */
      std::list<cGamePC *>::iterator y = x;
      if(x == PCList.begin()) { y = PCList.end(); }
    else if((KEY->PAGEDOWN()) && (PCList.size() > 1))
      /* Switch focus to next character */
      std::list<cGamePC *>::iterator y = x;
      if(x == --PCList.end()) { y = PCList.begin(); (*y)->ChangeFocus(true); }
      else { (*(++y))->ChangeFocus(true); }
    /* Processes user input */

The problem is that the change of focus doesn't seem to occur. Any idea what I'm doing wrong?