DirectAnimation Animated Header --DAGeometry Class DirectAnimation Animated Header --DAGeometry Class* Microsoft DirectAnimation SDK
*Contents  *Index  *Topic Contents
*Previous Topic: DAFontStyle Class
*Next Topic: DAImage Class

DAGeometry Class


The DAGeometry class is a class of three-dimensional objects that includes surfaces, lights, sounds, their attributes, and/or combinations of these elements. Like other DirectAnimation objects, the value of the elements of the geometry can change over time.

In general, every geometry behavior is spatially infinite and of infinite resolution. Conceptually, each of the infinitely many points in the geometry has associated with it an opacity value, a color, a normal (used for lighting computations), a texture coordinate, a detectability value, and a single-channel sound emanating from that point (generally, this is silence).

Surface geometry is either detectable or not. If a surface is detectable, the geometry fires an event whenever the cursor passes over a surface point. Neither lights nor sounds are detectable (or pickable).

Light geometries include ambient lights, directional lights, point lights, and spotlights. Light geometries can be attributed with both color and distance attenuation.

A texture in a geometry is an image, the points of which are mapped to the surface of the three-dimensional object represented by the geometry. If there is no surface in the geometry, the texture is ignored.

A geometry can also be a sound. The sound is audible when the geometry is within the appropriate range of a microphone behavior.

The bounding box query is used to construct and compose media, and different types of images and behaviors provide specific bounding boxes. This means, for example, that the bounding box of an image is not defined as the smallest axis-aligned, enclosing region of the non-transparent parts of an image. Instead, bounding boxes are defined on a per-operation basis. The emptyGeometry object, for example, has its own definition of a bounding box, defined below.

This class inherits from DABehavior.

DAGeometry Functions

bullet1.gifDiffuseColor

bullet1.gifLightAttenuationAnim

bullet1.gifLightAttenuation

bullet1.gifLightColor

bullet1.gifOpacityAnim

bullet1.gifOpacity

bullet1.gifPickable

bullet1.gifRender

bullet1.gifRenderSound

bullet1.gifTexture

bullet1.gifTransform

bullet1.gifUndetectable


DiffuseColor

DAGeometry Class

Specifies the diffuse color of the new DAGeometry object. The diffuse color is the diffuse (or matte) reflective color of the surface. By default, the diffuse color is white. The bounding box is the bounding box of the underlying geometry.

geometryObj.DiffuseColor(
  col
  )

Parameters
col
The DAColor object that is the color.
Return Values

Returns the DAGeometry object.

Remarks

This attribute overrides previous values.


LightAttenuationAnim

DAGeometry Class

Creates a DAGeometry in which any light sources have the given attenuation. The new attenuation is set to 1 / (const + linear ´ d + quadratic ´ d2) where d is the distance from the light to the object. By default, the attenuation coefficients are (1, 0, 0), which means no light attenuation. The bounding box is the bounding box of the underlying geometry.

geometryObj.LightAttenuationAnim(
  const,
  linear,
  quadratic
  )

Parameters
const, linear, and quadratic
The DANumber objects specifying the attenuation of a light source. These must be animated numbers.
Return Values

Returns the DAGeometry object.

Remarks

An attenuation of (1, 1, 0) gives a linear attenuation that is useful for light falloff in a room. An attenuation of (1, 0, 1) gives a quadratic attenuation that simulates lights that are in the open, such as street lamps and headlights. This attribute overrides previous values.


LightAttenuation

DAGeometry Class

Same as LightAttenuationAnim except that the arguments are non-animated numbers (doubles).

geometryObj.LightAttenuation(
  const,
  linear,
  quadratic
  )


LightColor

DAGeometry Class

Creates a new DAGeometry object in which all embedded lights have the specified color. By default, a light source is white. The bounding box is the bounding box of the underlying geometry.

geometryObj.LightColor(
  col
  )

Parameters
col
The DAColor object.
Return Values

Returns the DAGeometry object.

Remarks

This attribute overrides previous values.


OpacityAnim

DAGeometry Class

Sets the opacity value for all surfaces to opac. Opacity values can range from 0.0 to 1.0. If the corresponding DANumber object has a value outside this range, the integer part of the value is discarded and only the fractional part is used. By default, the opacity is 1.

geometryObj.OpacityAnim(
  opac
  )

Parameters
opac
The DANumber object representing the opacity value. The geometry is fully opaque if the value is 1, and fully transparent if the value is 0. This must be an animated number.
Return Values

Returns the DAGeometry object.

Remarks

This function composes values. The resulting opacity is the new value times the old value.


Opacity

DAGeometry Class

Same as OpacityAnim except that opac is a non-animated number (a double).

geometryObj.Opacity(
  opac
  )


Pickable

DAGeometry Class

Makes a DAGeometry object pickable. Use this function along with the returned DAPickableResult object to create a reactive behavior (This means that, when the mouse is in the pickable area, an event occurs).

The behavior of a "pickable" image is identical to that of an ordinary image until the mouse is in the pickable region and there are no geometries (other than undetectable ones) between it and the mouse. Then, an event (created in DAPickableResult) occurs.

geometryObj.Pickable( )

Return Values

Returns the DAPickableResult object.


Render

DAGeometry Class

Creates a DAImage object that is a two-dimensional projection of geometryObj. The camera parameter defines how the geometry is projected into two dimensions. The resulting image is infinite in extent. The bounding box of a rendered geometry is the axis-aligned extent of the projection of the three-dimensional bounding box onto the image plane.

geometryObj.Render(
  camera
  )

Parameters
camera
The DACamera object.
Return Values

Returns the DAImage object.


RenderSound

DAGeometry Class

Creates a DASound object that represents the sound associated with geometryObj as detected by the given microphone.

geometryObj.RenderSound(
  mic
  )

Parameters
mic
The DAMicrophone object.
Return Values

Returns the DASound object.


Texture

DAGeometry Class

Creates a DAGeometry object by mapping the given image, as defined by texture, to the surfaces of the original geometry. If the geometry has no surfaces, the texture is ignored. If the original geometry already has a texture, the new texture completely overlays the original. Texture maps have no effect when applied to a geometry that lacks texture coordinates. By default, a geometry has no texture. The bounding box is the bounding box of the underlying geometry.

geometryObj.Texture(
  image
  )

Parameters
image
The DAImage object.
Return Values

Returns the DAGeometry object.

Remarks

This attribute overrides previous values.


Transform

DAGeometry Class

Creates a DAGeometry object that is the result of applying the given three-dimensional transformation to the original geometry behavior. The transformation applies to all points in the geometry, including those associated with the positions and orientations of light sources, textures, and sounds. The bounding box of a transformed geometry is the axis-aligned box enclosing the box that is the result of applying the transformation to the underlying geometry.

geometryObj.Transform(
  xf
  )

Parameters
xf
The DATransform3 object.
Return Values

Returns the DAGeometry object.

Remarks

This function composes values. The resulting transformation is the new value applied to the old value.


Undetectable

DAGeometry Class

Creates a new, undetectable DAGeometry object from the original geometry. An undetectable geometry means that, while the geometry is still as visible or as audible as before, any attempts to pick it are ignored.

geometryObj.Undetectable( )

Return Values

Returns the DAGeometry object.

Remarks

The Undetectable function is useful for specifying which objects are detectable and which are not. For example, suppose a semi-transparent green sphere is used to simulate a glow around an object. Because this sphere encloses the object, the object itself would be unpickable. Instead, the pick information would always be for the sphere. Tagging the sphere as unpickable allows the object itself to be picked. This attribute overrides previous values.

DAGeometry Properties

bullet1.gifBoundingBox


BoundingBox

DAGeometry Class

A read-only property with a DABbox3 value that creates a bounding box object defining the axis-aligned bounding box enclosing all non-transparent portions of the geometryObj.

geometryObj.BoundingBox

Return Values

Returns the DABbox3 object.

Relevant Functions from the DAStatics Class

The following functions are defined in the DAStatics class and are most relevant to objects of type DAGeometry.

lib.ImportGeometry(url)

lib.ImportGeometryAsync(url, geoStandIn)

lib.SoundSource(sound)

lib.SpotLightAnim(fullcone, cutoff)

lib.SpotLight(fullcone, cutoff)

lib.UnionGeometry(g1, g2)

lib.UnionGeometryArray(geoArray)

Relevant Properties from the DAStatics Class

The following properties are defined in the DAStatics class and are most relevant to objects of type DAGeometry.

lib.AmbientLight

lib.DirectionalLight

lib.EmptyGeometry

lib.PointLight

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

*Top of Page