Add configurable main-road checkpoints and reconnect replacements; record Workshop 0.0.136
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -22,15 +22,15 @@ template<class T>struct Array:std::vector<T>{void Clear(){for(auto*p:*this)delet
|
||||
struct Prop{string Prefab;Vec Position,Forward,Right;double HalfWidth,HalfDepth,Height;
|
||||
Prop(string p,Vec v,Vec f,double w,double d,double h):Prefab(p),Position(v),Forward(f),Right({f.z,0,-f.x}),HalfWidth(w),HalfDepth(d),Height(h){}
|
||||
};
|
||||
struct Checkpoint{Vec m_Centre={1000,50,2000},m_Forward,m_Right;double m_Shoulder;
|
||||
struct Checkpoint{Vec m_Centre={1000,50,2000},m_Forward,m_Right;double m_Shoulder;bool m_Large=false;
|
||||
string COVER="cover",BARRIER="barrier",OBSTACLE="obstacle",SIGN="sign",TABLE="table",SHELTER="shelter";
|
||||
'''+s+r'''
|
||||
};
|
||||
int main(){
|
||||
for(double width:{4.,6.,10.,16.})for(int degrees=0;degrees<360;degrees+=15){
|
||||
Checkpoint l;double angle=degrees*3.141592653589793/180;
|
||||
for(bool large:{false,true})for(double width:{4.,6.,10.,16.})for(int degrees=0;degrees<360;degrees+=15){
|
||||
Checkpoint l;l.m_Large=large;double angle=degrees*3.141592653589793/180;
|
||||
l.m_Forward={std::sin(angle),0,std::cos(angle)};l.m_Right={std::cos(angle),0,-std::sin(angle)};
|
||||
l.m_Shoulder='''+shoulder+r''';Array<Prop*>props;l.Layout(props);assert(props.size()==8);
|
||||
l.m_Shoulder='''+shoulder+r''';Array<Prop*>props;l.Layout(props);assert(props.size()==(large?14:8));
|
||||
std::map<string,int>counts;std::vector<double>barriers;
|
||||
for(auto*p:props){counts[p->Prefab]++;
|
||||
Vec delta=p->Position-l.m_Centre;double across=dot(delta,l.m_Right),along=dot(delta,l.m_Forward);
|
||||
@@ -40,18 +40,19 @@ int main(){
|
||||
// Bound the compact footprint, including both road shoulders.
|
||||
assert(std::abs(across)+reach <= std::max(width*.5+1.2,4.5)+1e-6);
|
||||
double depth=std::abs(dot(p->Right,l.m_Forward))*p->HalfWidth+std::abs(dot(p->Forward,l.m_Forward))*p->HalfDepth;
|
||||
assert(std::abs(along)+depth <= 8.9+1e-6);
|
||||
assert(std::abs(along)+depth <= (large?21.4:8.9)+1e-6);
|
||||
if(p->Prefab=="barrier")barriers.push_back(along);
|
||||
if(p->Prefab=="sign")assert(dot(p->Forward,l.m_Forward)*along>0); // both approaches face outward
|
||||
// Guard starting volumes cannot intersect any prop in the planned post.
|
||||
for(int side:{-1,1})for(int row:{-1,1}){
|
||||
for(int side:{-1,1})for(int row=0;row<(large?4:2);row++){
|
||||
Vec guard=l.GuardPosition(side,row);
|
||||
Vec rel=guard-p->Position;
|
||||
assert(std::abs(dot(rel,p->Right))>p->HalfWidth+.6 || std::abs(dot(rel,p->Forward))>p->HalfDepth+.6);
|
||||
}
|
||||
}
|
||||
assert(counts["cover"]==4&&counts["barrier"]==2&&counts["sign"]==2&&counts.size()==3);
|
||||
assert(barriers.size()==2&&std::abs(barriers[0]-barriers[1])>11.9);
|
||||
assert(counts["cover"]==(large?8:4)&&counts["barrier"]==(large?4:2)&&counts["sign"]==2&&counts.size()==3);
|
||||
assert(barriers.size()==(large?4:2));
|
||||
if(!large)assert(std::abs(barriers[0]-barriers[1])>11.9);
|
||||
// No physical prop footprint intersects another (separating axes).
|
||||
for(size_t i=0;i<props.size();i++)for(size_t j=i+1;j<props.size();j++){
|
||||
auto*a=props[i];auto*b=props[j];bool separate=false;
|
||||
@@ -66,7 +67,7 @@ int main(){
|
||||
}
|
||||
}
|
||||
''')
|
||||
print('PASS: shipped checkpoint layout preserves vehicle lane, opposing signs, staggered barriers, clear guard slots and separate props across 4–16m roads and all tested headings')
|
||||
print('PASS: both shipped checkpoint layouts preserve vehicle lane, opposing signs, staggered barriers, clear guard slots and separate props across 4–16m roads and all tested headings')
|
||||
|
||||
# Execute the actual clearance path: owned pieces are excluded only after
|
||||
# checking guards; terrain and foreign obstructions remain authoritative.
|
||||
|
||||
Reference in New Issue
Block a user