forked from StudioInfinity/dyna3
Centralize the curvature component index constant
This commit is contained in:
parent
52d99755f9
commit
7f21e7e999
1 changed files with 6 additions and 4 deletions
|
@ -58,6 +58,8 @@ pub struct Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Element {
|
impl Element {
|
||||||
|
const CURVATURE_COMPONENT: usize = 3;
|
||||||
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
id: String,
|
id: String,
|
||||||
label: String,
|
label: String,
|
||||||
|
@ -217,9 +219,10 @@ pub struct HalfCurvatureRegulator {
|
||||||
|
|
||||||
impl HalfCurvatureRegulator {
|
impl HalfCurvatureRegulator {
|
||||||
pub fn new(subject: ElementKey, assembly: &Assembly) -> HalfCurvatureRegulator {
|
pub fn new(subject: ElementKey, assembly: &Assembly) -> HalfCurvatureRegulator {
|
||||||
const CURVATURE_COMPONENT: usize = 3;
|
|
||||||
let measurement = assembly.elements.map(
|
let measurement = assembly.elements.map(
|
||||||
move |elts| elts[subject].representation.with(|rep| rep[CURVATURE_COMPONENT])
|
move |elts| elts[subject].representation.with(
|
||||||
|
|rep| rep[Element::CURVATURE_COMPONENT]
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
let set_point = create_signal(SpecifiedValue::from_empty_spec());
|
let set_point = create_signal(SpecifiedValue::from_empty_spec());
|
||||||
|
@ -262,8 +265,7 @@ impl ProblemPoser for HalfCurvatureRegulator {
|
||||||
self.set_point.with_untracked(|set_pt| {
|
self.set_point.with_untracked(|set_pt| {
|
||||||
if let Some(val) = set_pt.value {
|
if let Some(val) = set_pt.value {
|
||||||
if let Some(col) = elts[self.subject].column_index {
|
if let Some(col) = elts[self.subject].column_index {
|
||||||
const CURVATURE_COMPONENT: usize = 3;
|
problem.frozen.push(Element::CURVATURE_COMPONENT, col, val);
|
||||||
problem.frozen.push(CURVATURE_COMPONENT, col, val);
|
|
||||||
} else {
|
} else {
|
||||||
panic!("Tried to write problem data from a regulator with an unindexed subject");
|
panic!("Tried to write problem data from a regulator with an unindexed subject");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue