JSim 2026.06.01-p(1)
Loading...
Searching...
No Matches
frcsim::GoalStructure Struct Reference

Scoring volume definition used by arena presets and projectile checks. More...

#include <goal_structure.hpp>

Public Types

enum class  Shape { kBox , kSphere , /home/runner/work/JSim/JSim/vendordep/src/main/driver/include/frcsim/field/goal_structure.hpp , kCustom }
 Built-in geometry modes for goal containment tests. More...
enum class  AcceptedType {
  kAny , kBall , kCustom1 , kCustom2 ,
  kCustom3 , kCustom4
}
 Supported gamepiece type filters for scoring validation. More...

Public Member Functions

bool contains (const Vector3 &position_m) const
 Test whether a position is contained within this goal's volume.
bool velocityAllowed (const Vector3 &velocity_mps) const
 Test whether a velocity satisfies score acceptance constraints.

Public Attributes

Shape shape {Shape::kBox}
Vector3 center_m {}
 Goal center position in world coordinates (meters).
Vector3 half_extents_m {0.2, 0.2, 0.2}
 Half-extent dimensions used when shape is kBox (meters).
double radius_m {0.25}
 Sphere radius used when shape is kSphere (meters).
AcceptedType accepted_type {AcceptedType::kBall}
 Filter for accepted gamepiece types (allows selective scoring).
bool require_positive_vertical_velocity {false}
 When true, scoring requires upward (+Z) velocity unless custom validator overrides.
std::function< bool(const Vector3 &)> custom_position_checker {}
 Optional custom position test for complex geometry in kCustom mode.
std::function< bool(const Vector3 &)> custom_velocity_validator {}
 Optional custom validator for velocity constraints during scoring.

Detailed Description

Scoring volume definition used by arena presets and projectile checks.

Member Enumeration Documentation

◆ AcceptedType

Supported gamepiece type filters for scoring validation.

Enumerator
kAny 
kBall 
kCustom1 
kCustom2 
kCustom3 
kCustom4 
Examples
/home/runner/work/JSim/JSim/vendordep/src/main/driver/include/frcsim/field/goal_structure.hpp.

◆ Shape

enum class frcsim::GoalStructure::Shape
strong

Built-in geometry modes for goal containment tests.

Enumerator
kBox 
kSphere 
/home/runner/work/JSim/JSim/vendordep/src/main/driver/include/frcsim/field/goal_structure.hpp 

User-defined shape handled by custom_position_checker.

To use this mode, set shape to kCustom and provide custom_position_checker.

goal.center_m = Vector3(5.0, 2.0, 1.6);
goal.custom_position_checker = [c = goal.center_m](const Vector3& p) {
// Example: accept points inside a simple vertical "capsule-like"
scoring zone. const Vector3 d = p - c; const double radial =
std::sqrt(d.x * d.x + d.y * d.y); return radial <= 0.35 && d.z >= -0.25
&& d.z <= 0.45;
};
Scoring volume definition used by arena presets and projectile checks.
Definition goal_structure.hpp:15
Shape shape
Definition goal_structure.hpp:52
std::function< bool(const Vector3 &)> custom_position_checker
Optional custom position test for complex geometry in kCustom mode.
Definition goal_structure.hpp:66
@ kCustom
Definition goal_structure.hpp:38
Vector3 center_m
Goal center position in world coordinates (meters).
Definition goal_structure.hpp:54
3D vector utility used throughout JSim physics.
Definition vector.hpp:22
double z
Z component.
Definition vector.hpp:28
double x
X component.
Definition vector.hpp:24
double y
Y component.
Definition vector.hpp:26
kCustom 
Examples
/home/runner/work/JSim/JSim/vendordep/src/main/driver/include/frcsim/field/goal_structure.hpp.

Member Function Documentation

◆ contains()

bool frcsim::GoalStructure::contains ( const Vector3 & position_m) const
inline

Test whether a position is contained within this goal's volume.

Parameters
position_mPosition to test in world coordinates (meters).
Returns
True when position is inside the goal geometry.
Examples
/home/runner/work/JSim/JSim/vendordep/src/main/driver/include/frcsim/field/goal_structure.hpp.

◆ velocityAllowed()

bool frcsim::GoalStructure::velocityAllowed ( const Vector3 & velocity_mps) const
inline

Test whether a velocity satisfies score acceptance constraints.

Parameters
velocity_mpsVelocity vector in world frame (m/s).
Returns
True when velocity meets configured requirements.
Examples
/home/runner/work/JSim/JSim/vendordep/src/main/driver/include/frcsim/field/goal_structure.hpp.

Member Data Documentation

◆ accepted_type

AcceptedType frcsim::GoalStructure::accepted_type {AcceptedType::kBall}

Filter for accepted gamepiece types (allows selective scoring).

Examples
/home/runner/work/JSim/JSim/vendordep/src/main/driver/include/frcsim/field/goal_structure.hpp.

◆ center_m

Vector3 frcsim::GoalStructure::center_m {}

Goal center position in world coordinates (meters).

Examples
/home/runner/work/JSim/JSim/vendordep/src/main/driver/include/frcsim/field/goal_structure.hpp.

◆ custom_position_checker

std::function<bool(const Vector3&)> frcsim::GoalStructure::custom_position_checker {}

Optional custom position test for complex geometry in kCustom mode.

Examples
/home/runner/work/JSim/JSim/vendordep/src/main/driver/include/frcsim/field/goal_structure.hpp.

◆ custom_velocity_validator

std::function<bool(const Vector3&)> frcsim::GoalStructure::custom_velocity_validator {}

Optional custom validator for velocity constraints during scoring.

Examples
/home/runner/work/JSim/JSim/vendordep/src/main/driver/include/frcsim/field/goal_structure.hpp.

◆ half_extents_m

Vector3 frcsim::GoalStructure::half_extents_m {0.2, 0.2, 0.2}

Half-extent dimensions used when shape is kBox (meters).

Examples
/home/runner/work/JSim/JSim/vendordep/src/main/driver/include/frcsim/field/goal_structure.hpp.

◆ radius_m

double frcsim::GoalStructure::radius_m {0.25}

◆ require_positive_vertical_velocity

bool frcsim::GoalStructure::require_positive_vertical_velocity {false}

When true, scoring requires upward (+Z) velocity unless custom validator overrides.

Examples
/home/runner/work/JSim/JSim/vendordep/src/main/driver/include/frcsim/field/goal_structure.hpp.

◆ shape

Shape frcsim::GoalStructure::shape {Shape::kBox}

The documentation for this struct was generated from the following file: