Next: , Previous: , Up: Customizing the Relative Probability Function   [Contents][Index]

#### 2.6.4 Spur Weight

Use the following functions to query or set spur weight denoted by W[i] in relative probability function formulas mentioned in Relative Probability Function Types.

Function: int qsmm_get_actor_spur_weight (qsmm_actor_t actor, int spur_type, double *weight_p)
Function: int qsmm_set_actor_spur_weight (qsmm_actor_t actor, int spur_type, double weight)

If weight_p is not `NULL`, the function `qsmm_get_actor_spur_weight` sets *weight_p equal to weight for a spur type of an actor. The value of *weight_p obtained in this way is always finite. The function `qsmm_set_actor_spur_weight` sets weight for a spur type of an actor to weight.

The argument actor specifies an actor handle. The argument spur_type specifies a spur type and cannot be less than -1 or greater than or equal to the number of spur types returned by the function `qsmm_get_actor_nspur` for the actor. If the actor is the small one, specifying spur type -1 is incorrect.

If the actor is the large one, the functions query or set the weight of a corresponding spur type of a small actor associated with the large actor. Special spur type -1 of a large actor corresponds to the automatic spur of an associated small actor (i.e. its spur type 0).

On success, the functions return a non-negative value. On failure, the functions return negative error code `QSMM_ERR_INVAL`. The following cases are failures:

• weight is not finite (is applicable only to `qsmm_set_actor_spur_weight`);
• – actor is the small one and spur_type is negative;
• spur_type is less than -1;
• spur_type is greater than or equal to the number of spur types specified in the field `nspur` of `qsmm_actor_desc_s` structure when creating the actor.

The function `qsmm_actor_create` initializes the weights of all spur types of a newly created actor to 1.

Next: , Previous: , Up: Customizing the Relative Probability Function   [Contents][Index]