From guest  Tue May 31 17:20:40 1994
From: "Drew Hess" <dhess@vision.arc.nasa.gov>
Message-Id: <9405311720.ZM4168@airy.arc.nasa.gov>
Date: Tue, 31 May 1994 17:20:33 -0700
X-Mailer: Z-Mail (3.1.0 22feb94 MediaMail)
To: info-performer@sgi.sgi.com
Subject: pfuPath routines
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Status: OR

I am looking for documentation or (preferably) some example code that details
the use of the pfuPath routines in libpfu.  I realize that libpfu is
unsupported and subject to change in future releases, but I am hoping that
someone out there has made good use of these routines.  I've started by looking
at the path.c source for libpfu, but some actual examples of its use would be
helpful.

Thanks

-dwh-
dhess@vision.arc.nasa.gov




From guest  Tue May 31 18:11:24 1994
From: "Michael Jones" <mtj@babar>
Message-Id: <9405311811.ZM20736@babar.asd.sgi.com>
Date: Tue, 31 May 1994 18:11:08 -0700
In-Reply-To: "Drew Hess" <dhess@vision.arc.nasa.gov>
        "pfuPath routines" (May 31,  5:20pm)
References: <9405311720.ZM4168@airy.arc.nasa.gov>
X-Mailer: Z-Mail (3.1.0 22feb94 MediaMail)
To: "Drew Hess" <dhess@vision.arc.nasa.gov>, info-performer@sgi.sgi.com
Subject: Re: pfuPath routines
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Status: O

On May 31,  5:20pm, Drew Hess wrote:
> Subject: pfuPath routines

:I am looking for documentation or (preferably) some example code that details
:the use of the pfuPath routines in libpfu.

man pfupath is the first source.  The idea is that a path is a list of
segments,
each of which is either a vector or an arc.  The handy thing is that if you set
a radius of curvature, the path routines will make an arc for you that joins
the two vectors.  This is how the truck is sent about the performer town demo.

:I realize that libpfu is
:unsupported and subject to change in future releases, but I am hoping that
:someone out there has made good use of these routines.  I've started by
looking
:at the path.c source for libpfu, but some actual examples of its use would be
:helpful.

If you develop improvements for the path logic send it to us and we'll include
it in future releases of IRIS Performer.

Here are the path-related excerpts from the "IRIS Performer Town" demo that's
in buttonfly in the demos account.  That demo uses a version of perfly that
takes names of models and their paths from the command line (via the "A"
keyword) and maintains a list of vehicles based on this information.  Once the
argument list has been processed, a trip is made through the list to load each
model with a pfDCS node above it and to load its path definition as well.
Finally, each model is advanced along the path by one time step in the main
simulation loop.  Here are the code fragments:

==================================================================
=  handy structure definition used later in code
==================================================================

/* autopilot vehicle support */
typedef struct
{
    char modelName[PF_MAXSTRING];
    char pathName[PF_MAXSTRING];
    char vehicleName[PF_MAXSTRING];
    pfDCS *dcs;
    pfuPath *path;
    pfVec3 xyz;
    pfVec3 hpr;
} Vehicle;

#define	MAX_VEHICLES	32
Vehicle vehicle[MAX_VEHICLES] = {"", "", "", NULL, NULL, {0,0,0}, {0,0,0}};
long vehicles = 0;

==================================================================
=  parse vehicle definitions: remember vehicles and paths
==================================================================

    /* process command-line arguments */
    while ((opt = getopt(argc, argv, OptionStr)) != -1)
    {
	/* specify "autopilot" vehicle */
	case 'A':
	    {
	    if (vehicles < MAX_VEHICLES)
	    {
		/* initialize vehicle defininition */
		vehicle[vehicles].modelName[0] = '\0';
		vehicle[vehicles].pathName[0] = '\0';
		sprintf(vehicle[vehicles].vehicleName, "%d", vehicles);
		vehicle[vehicles].dcs = NULL;
		vehicle[vehicles].path = NULL;

		/* parse file names from argument */
		sscanf(optarg, "%[^,],%[^,],%s",
		    vehicle[vehicles].modelName,
		    vehicle[vehicles].pathName,
		    vehicle[vehicles].vehicleName);

		/* increment vehicle count */
		vehicles++;
	    }
	    else
		pfNotify(PFNFY_INFO, PFNFY_PRINT,
		    "Too many autopilot vehicles");
	    }
	    break;

==================================================================
=  pass through vehicle list: loading vehicles and paths
==================================================================

    /* load each of the autopilot vehicles */
    for (i = 0; i < vehicles; i++)
    {
	long j;

	/* has file already been loaded ? */
	for (j = 0, root = NULL; j < i && root == NULL; j++)
	    if (strcmp(vehicle[i].modelName, vehicle[j].modelName) == 0)
		root = pfGetChild(vehicle[j].dcs, 0);

	/* load named file */
	if (root == NULL)
	    root = LoadFile(vehicle[i].modelName, NULL);
	Loaded = 0;

	/* create new vehicle and attach model to it */
	if (root != NULL)
	{
	    /* load database */
	    vehicle[i].dcs = pfNewDCS();
	    pfAddChild(vehicle[i].dcs, root);
	    pfAddChild(scene, vehicle[i].dcs);

	    /* load path */
	    vehicle[i].path = pfuNewPath();
	    pfuAddFile(vehicle[i].path, vehicle[i].pathName);
	}
    }

==================================================================
=  advance each vehicle during each trip through the simulation
==================================================================

	/* simulate each autopilot vehicle */
	for (i = 0; i < vehicles; i++)
	    if (vehicle[i].dcs != NULL && vehicle[i].path != NULL)
	    {
		/* advance along path */
		pfuFollowPath(vehicle[i].path,
		    1.0/pfGetFrameRate(),
		    vehicle[i].xyz,
		    vehicle[i].hpr);

		/* update vehicle DCS */
		pfDCSRot(vehicle[i].dcs,
		    vehicle[i].hpr[PF_H],
		    vehicle[i].hpr[PF_P],
		    vehicle[i].hpr[PF_R]);
		pfDCSTrans(vehicle[i].dcs,
		    vehicle[i].xyz[PF_X],
		    vehicle[i].xyz[PF_Y],
		    vehicle[i].xyz[PF_Z]);
	    }


-- 

Be seeing you,      Phone:415.390.1455  Fax:415.390.2658 M/S:9U-590
Michael T. Jones    Silicon Graphics, Advanced Graphics Division
mtj@sgi.com         2011 N. Shoreline Blvd., Mtn. View, CA 94039-7311






From guest  Wed Apr 13 09:35:15 1994
Date: Wed, 13 Apr 94 17:34:38 +0100
From: angus@death.reading.sgi.com (Angus Henderson)
Message-Id: <9404131634.AA12835@death.reading.sgi.com>
To: info-performer
Subject: pfuFollowPath
Status: OR


Where is there a code fragment that shows how you use pfuFollowPath etc.. ?

ANgus

"Imagine your witty quote here"




