Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
Shape.h
1// trax track library
2// AD 2023
3//
4// "the resolution of all the fruitless searches"
5//
6// Peter Gabriel
7//
8//
9// Copyright (c) 2025 Trend Redaktions- und Verlagsgesellschaft mbH
10// Copyright (c) 2019 Marc-Michael Horstmann
11//
12// Permission is hereby granted to any person obtaining a copy of this software
13// and associated source code (the "Software"), to use, view, and study the
14// Software for personal or internal business purposes, subject to the following
15// conditions:
16//
17// 1. Redistribution, modification, sublicensing, or commercial use of the
18// Software is NOT permitted without prior written consent from the copyright
19// holder.
20//
21// 2. The Software is provided "AS IS", without warranty of any kind, express
22// or implied.
23//
24// 3. All copies of the Software must retain this license notice.
25//
26// For further information, please contact: horstmann.marc@trendverlag.de
27
28#pragma once
29
30#include "Geom.h"
31
32namespace trax{
33
34 struct Axis;
35
41 struct Shape{
42
43 // Shape's name:
44
49 virtual void SetName( const char* name ) noexcept = 0;
50
51
53 virtual const char* GetName() const noexcept = 0;
54
55
56 // Shape's pose:
57
63 virtual void SetFrame( const spat::Frame<Length,One>& frame ) noexcept = 0;
64
65
67 virtual void GetFrame( spat::Frame<Length,One>& frame ) const noexcept = 0;
68
69
72 virtual spat::Box<Length> GetExtent() const noexcept = 0;
73
74
80
84 virtual int Attach( std::unique_ptr<Geom> pGeom ) = 0;
85
89 virtual int Attach( std::vector<std::unique_ptr<Geom>>& geoms ) = 0;
91
92
98 virtual std::unique_ptr<Geom> Remove( int idx ) = 0;
99
100
105 virtual void Clear() noexcept = 0;
106
107
109 virtual int Count() const = 0;
110
111
114 virtual Geom& Get( int idx = 0 ) const = 0;
115
116
118 //virtual int CountAxes() const = 0;
119
120
122 //virtual std::shared_ptr<Axis> GetAxis( int idx = 0 ) const = 0;
123
124
125 virtual ~Shape() = default;
126 };
127
128}
Value< Dimension< 0, 0, 0 > > One
Dimensionless value.
Definition DimensionedValues.h:319
Value< Dimension< 1, 0, 0 > > Length
Length.
Definition DimensionedValues.h:324
The namespace provides classes and methods for spatial computations.
Definition Box.h:32
STL namespace.
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
Axis aligned box.
Definition Box.h:41
A Frame ("TNBFrame") describes a location in 3d space and an orientation using a right handed coordin...
Definition Frame.h:52
A Geom is used for collision detection. It differs from a Shape in that it defines the most simple el...
Definition Geom.h:50
A Shape is a collection of Geoms.
Definition Shape.h:41
virtual std::unique_ptr< Geom > Remove(int idx)=0
Removes the Geom with index idx from the Shape.
virtual void SetName(const char *name) noexcept=0
Sets the name of the Shape.
virtual void Clear() noexcept=0
Remove all Geoms from the Shape.
virtual void GetFrame(spat::Frame< Length, One > &frame) const noexcept=0
Gets the pose in global coordinates.
virtual void SetFrame(const spat::Frame< Length, One > &frame) noexcept=0
Sets position and orientation (pose) in global coordinates.
virtual const char * GetName() const noexcept=0
virtual Geom & Get(int idx=0) const =0
virtual int Attach(std::unique_ptr< Geom > pGeom)=0
Attach a Geom to the Shape.
virtual spat::Box< Length > GetExtent() const noexcept=0
Gets the minimum axis aligned box that includes the the Geoms completely.
virtual int Count() const =0