# cee::geo::GeometryModel

class `GeometryModel` : public Model

  GeometryModel is a subclass of Model that can handle a large number of parts efficiently.

  This model is especially very well suited if the parts provided have equal/shared attributes/effects like color, line width and so on.

  Each Part may be built up from either Points, Indexed Polylines, Indexed Triangles, Triangle Fans or Triangle Strips and with relevant Effects like color, textures, opacity/transparency, size/width, halo/silhouetted edges, lighting etc.

  See also

  Part, PartSettings, Data, and Effect

  Public Functions

  `GeometryModel`()

    Constructs an empty model.

  virtual BoundingBox `boundingBox`()

    Returns the bounding box of the model.

    See also

    update()

    Note

    update() must have been called at least once, either manually or automatically, for this to return a valid bounding box.

  virtual Str `modelInfo`() const

    Returns information about the model.

  virtual void `update`(bool forceRecreate)

    Updates the model, optimizing its rendering.

    Note

    This may take some time dependent how much data the part contains

    Note

    This is mandatory and will be automatically run before rendering if not already done so

  const Mat4d &`transformation`() const

    Returns the transformation matrix used for the whole model.

    See also

    setTransformation

  void `setTransformation`(const Mat4d &transformMatrix)

    Transforms the entire model using the given transformation matrix.

    This matrix is combined with any local transformation matrices for each part.

  size_t `partCount`() const

    Returns the number of geometry parts.

  size_t `partIndex`(Part *part) const

    Gets part index.

    Returns UNDEFINED_SIZE_T if not present.

    See also

    hasPart

    Warning

    The index may be changed internally at any time.

    Warning

    Needs to update internal structures if parts have been added and/or removed.

  Part *`part`(size_t index)

    Returns the geometry part at the given index.

    Note

    The index must be valid

  const Part *`part`(size_t index) const

    Returns the geometry part at the given index.

    Note

    The index must be valid

  Part *`partById`(int id)

    Returns the geometry part with the given id or NULL if not present.

    See also

    cee::geo::Part::id() and cee::geo::Part::setId()

    Note

    The part id’s are set by the user and do not have to be unique. This function will return the first part it finds with the given id.

  const Part *`partById`(int id) const

    Returns the geometry part with the given id or NULL if not present.

    See also

    cee::geo::Part::id() and cee::geo::Part::setId()

    Note

    The part id’s are set by the user and do not have to be unique. This function will return the first part it finds with the given id.

  void `addPart`(Part *part)

    Adds geometry part to model.

    Part must not already be present in the model

    Note

    A part can only be in one model at a time

  void `removePart`(Part *part)

    Removes geometry part from model.

    Part must already be present in the model

  void `removeAllParts`()

    Removes all geometry parts from model.

  bool `hasPart`(Part *part) const

    Returns true if the part is in the model.

    See also

    partIndex

  bool `rayIntersect`(int x, int y, const vis::View &view, HitItem *hitItem)

    Does picking at the given screen coordinates, returning true if anything was hit.

    The x and y coordinates must be specified in OpenGL style coordinates, which means a right handed coordinate system with the origin in the lower left corner of the window.

    The hit item object describes where the ray created from the screen coordinates hit the model. See HitItem for a listing of available hit information.

    Returns true if something was hit.

    See also

    Ray and cee::geo::HitItem

  bool `regionIntersect`(int x, int y, unsigned int width, unsigned int height, const vis::View &view, bool acceptPartiallyContainedParts, PartCollection *intersectedParts)

    Finds the parts that are (partially) inside the given region.

    The intersectedParts collection will contain all parts that are inside the given region. If acceptPartiallyContainedParts is set to true, parts will be considered inside if they are partially inside (at least one pixel of one item) the region. If false, the entire part needs to be completely inside the region.

    The x and y coordinates must be specified in OpenGL style coordinates, which means a right handed coordinate system with the origin in the lower left corner of the window. The width and height is in pixels. Both height and width must be > 0.

    Returns true if any parts was accepted (intersectedParts.count() > 0)

  bool `regionIntersectPartItems`(int x, int y, unsigned int width, unsigned int height, const vis::View &view, bool acceptPartiallyContainedItems, std::vector<PartHitItems> *hitItems)

    Finds the parts that are (partially) inside the given region.

    The partList will contain all parts that are inside the given region. If acceptPartiallyContainedParts is set to true, parts will be considered inside if they are partially inside (at least one pixel of one item) the region. If false, the entire part needs to be completely inside the region.

    The x and y coordinates must be specified in OpenGL style coordinates, which means a right handed coordinate system with the origin in the lower left corner of the window. The width and height is in pixels. Both height and width must be > 0.

    Returns true if any parts was accepted (hitItemArr->size() > 0)

  bool `polygonIntersect`(const std::vector<Vec2f> &polygonInWindowCoordinates, const vis::View &view, bool acceptPartiallyContainedParts, PartCollection *intersectedParts)

    Finds the parts that are (partially) inside the given region.

    The intersectedParts collection will contain all parts that are inside the given region. If acceptPartiallyContainedParts is set to true, parts will be considered inside if they are partially inside (at least one pixel of one item) the region. If false, the entire part needs to be completely inside the region.

    The x and y coordinates must be specified in OpenGL style coordinates, which means a right handed coordinate system with the origin in the lower left corner of the window. The width and height is in pixels.

    Returns true if any parts was accepted (intersectedParts.count() > 0)

  bool `rayIntersect`(const Ray &ray, const vis::View &view, HitItem *hitItem)

    Does picking based on a ray in world coordinates, returning true if anything was hit.

    The hit item object describes where the ray hit the model. See HitItem for a listing of available hit information.

    Returns true if something was hit.

    See also

    Ray and cee::geo::HitItem

  size_t `renderedPartCount`() const

    Returns the number of unique parts being rendered by the Visualization component for this model.

    Note: This is only used for reference and does not correspond to the number of parts in this model. The GeometryModel will try to minimized the number of rendered parts by combining parts with the same visual appearance. This is transparent for the user and cannot be controlled.

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your Docs generative AI assistant. Ask me anything about HOOPS Envision for Desktop or choose a sample question below to start a conversation:

What is HOOPS Envision for Desktop?
What are the latest release notes for HOOPS Envision for Desktop?
How do I start evaluating HOOPS Envision for Desktop?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...