Interface FilterAABBInterface

The FilterAABBInterface interface is a FilterItemInterface to elect part instances intersecting an axis aligned box.

The inclusion algorithm may be strict, i.e. all triangles of a part instance must be strictly contained inside the box for the part instance to be elected, or loose, in this case, any part instance with a triangle inside the box or intersecting the box will be elected (setOverlapped).

Upon creation a FilterAABBInterface is set to elect all part instances with a strict policy, i.e. all part instances having all triangles strictly inside the box will be elected on a unit box centered on (0,0,0).

The FilterAABBInterface interface is created through the createFilterAABB.

The FilterAABBInterface has the type FT_AABB (getFilterType).

The FilterAABBInterface has a depth contribution of 1.

/** 
* Sample to illustrate the use of an intersection of
* FilterAABBInterface and FilterAttributeInterface.
*/
import {
AABB, AttributesDictionaryInterface, AttributeInfoInterface, AttributeType, DataSessionInterface,
ConfContextInterface, VisibilityContextInterface, FilterSolverInterface,
FilterAABBInterface, FilterAttributeInterface, FilterOperator,
} from 'generated/documentation/appinfiniteapi';

// the DataSessionInterface has been created previously and is connected
let lDataSession : DataSessionInterface;

// MAKE SURE the attributes "CompletionStatus"
const lAttributeDictionary : AttributesDictionaryInterface = lDataSession.getAttributesDictionary();
const lAttributeInfo : AttributeInfoInterface | undefined = lAttributeDictionary.getAttributeInfo('CompletionStatus');
// make sure the attribute is a string one
console.assert((lAttributeInfo !== undefined) && (lAttributeInfo.getAttributeType() === AttributeType.ATTR_STRING));

// create the resolution chain :
// create a filtering context "unconfigured"
// first create ConfContextInterface "unconfigured"
const lConfCtx : ConfContextInterface = lDataSession.createConfContext();
// and create the filtering context and bind it to the unconfigured ConfContextInterface
const lConfVisibilityCtx: VisibilityContextInterface = lDataSession.createVisibilityContext();
lConfVisibilityCtx.setConfContext(lConfCtx);

// the AABB to use
const lABB : AABB = new AABB();
lABB.mCenter.x = 3.0;
lABB.mCenter.y = 3.0;
lABB.mCenter.z = 3.0;

lABB.mHalfExtent.x = 10.0;
lABB.mHalfExtent.y = 10.0;
lABB.mHalfExtent.z = 10.0;

// create a Filter Solver
const lFilterSolver : FilterSolverInterface = lDataSession.createFilterSolver();

// create a box filter
const lFilterAABB : FilterAABBInterface = lDataSession.createFilterAABB();
// useless, FilterOperator.FO_UNION is the default operator when creating a new filter
// lFilterAABB.setFilterOperator(FilterOperator.FO_UNION);

lFilterAABB.setAABB(lABB);

// create an FilterAttributeInterface
const lFilterAttributes : FilterAttributeInterface = lDataSession.createFilterAttribute();
// completion status to done
lFilterAttributes.setAttributeName('CompletionStatus');
lFilterAttributes.setExactValues(['done']);
// no n/a
lFilterAttributes.setNaValueChecked(false);

// intersection is the way to go since intersection of box and instances that have the field "CompletionStatus"
// to "done"
// only change the operator of the filters except the first
lFilterAttributes.setFilterOperator(FilterOperator.FO_INTERSECTION);

// and add the filters
// push back (-1) the AABB filter
lFilterSolver.insertFilter(-1, lFilterAABB);
// push back (-1) the FilterAttributeInterface, as it is the second one, its operator is used and therefore
// intersection is used
lFilterSolver.insertFilter(-1, lFilterAttributes);

// set the conf context to use => unconfigured for this example
lFilterSolver.setVisibilityContext(lConfVisibilityCtx);
// and tell the DataSessionInterface to update the modified ConfContextInterface, VisibilityContextInterface and FilterSolverInterfaces
lDataSession.update();

Please refer to Available Filters for a list of other [FilterItemInterfaces](FilterItemInterface.html).
Metadata/Filters

See

Hierarchy

Methods

  • Adds a listener to an event type.

    When an event of the type pType fires, the callback pListener will be called. This function returns a unique string id that may be used in removeEventListenerById to allow simple listener removal. It is possible to add an object that will be included in the callback to avoid creating too many closures.

    Returns

    The id of the inserted callback (actually an UUID).

    Parameters

    • pType: string
      in
      The type of the event pListener will be called upon.
    • pListener: tListenerCallback
      in
      The listener function that fires when the given event type occurs.
    • pObject: undefined | Object
      in
      The optional object the callback will be called with when the given event fires.

    Returns string

  • Adds a listener to an event type.

    When an event of the type pType fires, the callback pListener will be called. This function returns a unique string id that may be used in removeEventListenerById to allow simple listener removal.

    Returns

    The id of the inserted callback (actually an UUID).

    Parameters

    • pType: string
      in
      The type of the event pListener will be called upon.
    • pListener: tListenerCallback
      in
      The listener function that fires when the given event type occurs.

    Returns string

  • Gets the axis align bounding box parameters.

    pAABBOut will be set with the content of the box.

    Parameters

    • pAABBOut: AABB
      out
      Upon completion, stores the current AABB of the FilterAABBInterface.

    Returns void

  • Gets the depth contribution of the FilterItemInterface.

    This value is usually one.

    Returns

    The depth contribution of the FilterItemInterface.

    Returns number

  • Gets a deep copy of the internal data of the FilterItemInterface.

    Returns

    The internal FilterItemInterface data.

    Returns any

  • Gets the identifier of the FilterItemInterface.

    Returns

    The identifier of the FilterItemInterface.

    Returns string

  • Tells if the EventDispatcher has such a callback registered for the given event type.

    Returns

    true if such a listener is installed for the given type of event.

    Parameters

    • pType: string
      in
      The type of the event to test.
    • pListener: tListenerCallback
      in
      The listener function that gets tested.

    Returns boolean

  • Tells if this object has been gotten rid off.

    Returns

    true if dispose has been called on this object.

    Returns boolean

  • Tells if the FilterItemInterface is enabled.

    If disabled, this FilterItemInterface is completely ignored during all the computations (the behavior is the same as if it had not been created).

    A FilterItemInterface is enabled by default.

    Returns

    true if the FilterItemInterface is enabled.

    Returns boolean

  • Tells if the FilterItemInterface is "inverted".

    When "inverted", a FilterItemInterface elects all the part instances that were not selected if it was not inverted.

    A FilterItemInterface is not "inverted" by default.

    Returns

    true if such a FilterItemInterface is "inverted".

    Returns boolean

  • Tells about the loose/strict including policy.

    If overlapped (loose), any part instance with at least one triangle overlapping the box will be elected, else any part instance should have all its triangles strictly included inside the box to be elected (strict).

    Upon creation, the FilterAABBInterface is set to include all part instances strictly inside the box (false as default).

    Returns

    true if the FilterAABBInterface including policy is loose.

    Returns boolean

  • Removes a listener from an event type.

    If no such listener is found, then the function returns false and does nothing. You must use the exact parameters that were used in addEventListener to actually remove the listener.

    Returns

    true if the callback was removed else false.

    Parameters

    • pType: string
      in
      The type of the listener that gets removed.
    • pListener: tListenerCallback

      The listener function that gets removed.

    • pObject: undefined | Object

      The listener object that was used when addEventListener was called.

    Returns boolean

  • Removes a listener from an event type.

    If no such listener is found, then the function returns false and does nothing. You must use the exact parameters that were used in addEventListener to actually remove the listener.

    Returns

    true if the callback was removed else false.

    Parameters

    • pType: string
      in
      The type of the listener that gets removed.
    • pListener: tListenerCallback

      The listener function that gets removed.

    Returns boolean

  • Removes a listener by its id.

    If no such listener is found, then the function returns false and does nothing. You must use the return value of addEventListener to actually remove the listener.

    Returns

    true if the callback was removed else false.

    Parameters

    • pId: string
      in
      The id returned by the call to [addEventListener](FilterAABBInterface.html#addEventListener) that you want to remove.

    Returns boolean

  • Sets the axis align bounding box.

    The FilterAABBInterface stores a copy of the data, the caller may change the box later without worrying about the FilterAABBInterface being modified.

    Does nothing if the AABB is left unchanged.

    Use addEventListener on the event FilterDataChanged to know when the FilterAABBInterface data changed.

    A FilterAABBInterface has a unit box centered on (0,0,0) by default.

    Returns true if pAABB is set.

    Returns

    true if the AABB is set.

    Parameters

    • pAABB: AABB
      in
      The axis aligned box to set.

    Returns boolean

  • Sets the FilterItemInterface enabled/disabled status.

    If disabled, this FilterItemInterface is completely ignored during all the computations (the behavior is the same as if it had not been created). Use addEventListener on the event FilterEnabledChanged to know when the FilterItemInterface has changed its enabled status.

    A FilterItemInterface is enabled by default.

    Parameters

    • pEnabled: boolean
      in
      If true, the given FilterItemInterface is enabled.

    Returns void

  • Sets the content of the FilterItemInterface from a former call to getFilterData.

    Use addEventListener on the event FilterDataChanged to know when the FilterItemInterface internal data changed.

    Returns

    true if the data is set.

    Parameters

    • pFilterData: any
      in
      Internal FilterItemInterface data to set.

    Returns boolean

  • Sets the identifier of the FilterItemInterface. Make sure the id is unique. A unique FilterItemInterface identifier is created if the identifier is not overridden.

    Parameters

    • pFilterId: string
      in
      The new identifier of the FilterItemInterface.

    Returns void

  • Sets the "inverted" status of the FilterItemInterface.

    When "inverted", a FilterItemInterface elects all the part instances that were not selected if it was not inverted. Use addEventListener on the event FilterInvertedChanged to know when the FilterItemInterface has changed its "inverted" status.

    A FilterItemInterface is not "inverted" by default.

    Parameters

    • pInverted: boolean
      in
      If true, such a FilterItemInterface will be "inverted".

    Returns void

  • Sets the loose/strict including policy.

    If overlapped (loose), any part instance with at least one triangle overlapping the box will be elected, else any part instance should have all its triangles strictly included inside the box to be elected (strict).

    Upon creation, the FilterAABBInterface is set to include all part instances strictly inside the box (false as default).

    Use addEventListener on the event FilterDataChanged to know when the FilterAABBInterface data changed.

    Parameters

    • pIncludeOverlappingTriangle: boolean
      in
      If set, any part instance with at least one triangle overlapping the box will be elected.

    Returns void