File size: 5,522 Bytes
5070096 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
standard library package SpatialItems {
doc
/*
* This package models physical items that have a spatial extent and act as a spatial frame of reference
* for obtaining position and displacement vectors of points within them.
*/
private import Objects::Point;
private import SpatialFrames::SpatialFrame;
private import Quantities::VectorQuantityValue;
private import MeasurementReferences::ThreeDCoordinateFrame;
private import MeasurementReferences::nullTransformation;
private import Time::Clock;
private import Time::TimeInstantValue;
private import ScalarValues::Natural;
private import ISQ::universalCartesianSpatial3dCoordinateFrame;
private import ISQ::Position3dVector;
private import ISQ::Displacement3dVector;
private import VectorFunctions::isZeroVector;
private import SequenceFunctions::isEmpty;
private import ControlFunctions::forAll;
item def SpatialItem :> SpatialFrame {
doc
/*
* A SpatialItem is an Item with a three-dimensional spatial extent that also acts as a SpatialFrame of reference.
*/
ref item :>> localClock : Clock[1] default Time::universalClock {
doc
/*
* A local Clock to be used as the corresponding time reference within this SpatialItem.
* By default this is the singleton universalClock.
*/
}
attribute coordinateFrame : ThreeDCoordinateFrame[1] default universalCartesianSpatial3dCoordinateFrame {
doc
/*
* The three-dimensional CoordinateFrame to be used as the measurement reference for position
* and displacement vector values relative to this SpatialItem.
* By default this is the singleton universalCartesianSpatial3dCoordinateFrame.
*/
}
item originPoint : Point[1] :> spaceShots {
doc
/*
* The Point at the origin of the coordinateFrame of this SpatialItem.
*/
}
assert constraint originPointConstraint {
doc
/*
* The CurrentPositionOf the originPoint must always be a zero vector.
*/
isZeroVector(CurrentPositionOf(originPoint, that))
}
item componentItems : SpatialItem[1..*] :> subitems {
doc
/*
* A SpatialItem with componentItems is entirely made up of those items (the SpatialItem occurs only
* as a collection of its componentItems). By default they have the same localClock and equivalent
* coordinate frame as the SpatialItem they make up. A SpatialItem without componentItems occurs
* on its own, separately from its subitems.
*/
item :>> localClock default (that as SpatialItem).localClock;
attribute :>> coordinateFrame {
attribute :>> mRefs default (that.that as SpatialItem).coordinateFrame.mRefs;
attribute :>> transformation[1] default nullTransformation {
attribute :>> source default (that.that.that as SpatialItem).coordinateFrame;
}
}
}
private attribute cunionNum: Natural [1] = if isEmpty(componentItems) ? 0 else 1;
private attribute componentUnion[cunionNum] :> unionsOf {
doc
/*
* A SpatialItem with componentItems is is a spatial union of them.
*/
item :>> elements : SpatialItem [1..*] = componentItems;
}
}
calc def PositionOf :> SpatialFrames::PositionOf {
doc
/*
* The PositionOf a Point relative to a SpatialItem, at a specific TimeInstantValue relative to a given Clock,
* is a positionVector that is a VectorQuantityValue in the coordinateFrame of the SpatialItem.
* The default Clock is the localClock of the SpatialItem.
*/
in point : Point[1];
in timeInstant : TimeInstantValue[1];
in enclosingItem :>> 'frame' : SpatialItem[1];
in clock : Clock[1] default enclosingItem.localClock;
return positionVector : Position3dVector[1] {
attribute :>> mRef = enclosingItem.coordinateFrame;
}
}
calc def CurrentPositionOf :> SpatialFrames::CurrentPositionOf {
doc
/*
* The CurrentPositionOf a Point relative to a SpatialItem and a Clock is the PositionOf
* the Point relative to the SpatialItem at the currentTime of the Clock.
*/
in point : Point[1];
in enclosingItem :>> 'frame' : SpatialItem[1];
in clock : Clock[1] default enclosingItem.localClock;
return positionVector : Position3dVector[1] {
attribute :>> mRef = enclosingItem.coordinateFrame;
}
}
calc def DisplacementOf :> SpatialFrames::DisplacementOf {
doc
/*
* The DisplacementOf two Points relative to a SpatialItem, at a specific TimeInstantValue relative to a
* given Clock, is the displacementVector computed as the difference between the PositionOf the
* first Point and PositionOf the second Point, relative to that SpatialItem, at that timeInstant.
*/
in point1 : Point[1];
in point2 : Point[1];
in timeInstant : TimeInstantValue[1];
in spatialItem :>> 'frame' : SpatialItem[1];
in clock : Clock[1] default spatialItem.localClock;
return displacementVector : Displacement3dVector[1] {
attribute :>> mRef = spatialItem.coordinateFrame;
}
}
calc def CurrentDisplacementOf :> SpatialFrames::CurrentDisplacementOf {
doc
/*
* The CurrentDisplacementOf two Points relative to a SpatialItem and a Clock is the DisplacementOf
* the Points relative to the SpatialItem, at the currentTime of the Clock.
*/
in point1 : Point[1];
in point2 : Point[1];
in spatialItem :>> 'frame' : SpatialItem[1];
in clock : Clock[1] default spatialItem.localClock;
return displacementVector : Displacement3dVector[1] {
attribute :>> mRef = spatialItem.coordinateFrame;
}
}
} |