Skip to main content

System

Struct System 

Source
pub struct System { /* private fields */ }
Expand description

系: 文書(Prescription、Arc で共有)と、そこから作る追跡の準備(座標系・近軸量・追跡の表などのキャッシュ)。 欄は書き換えられない(読むのは Deref で文書の欄、直すのは System::edit)。複製は文書を共有するので軽い

Implementations§

Source§

impl System

Source

pub fn configs(&self) -> Option<&Configs>

多重構成の表(無ければ None)

Source

pub fn set_config_count(&mut self, n: usize) -> Result<(), Error>

構成の数を n にする(増やした構成の値は今の値。1 で表を消す)。今の構成が n を超えたら 1 にする

Source

pub fn set_config_row( &mut self, p: Param, values: Vec<f64>, ) -> Result<(), Error>

表に行を足す(同じパラメータの行は置き換える)。values の長さは構成の数。今の構成の値を系に入れる。 材料・膜の行は System::set_config_materials・System::set_config_coatings で

Source

pub fn set_config_materials( &mut self, j: usize, names: &[String], ) -> Result<(), Error>

面 j の材料の行を足す(同じ面の材料の行は置き換える)。names は構成ごとの材料の名前(面の表の材料と同じ書き方)

Source

pub fn set_config_coatings( &mut self, j: usize, names: &[String], ) -> Result<(), Error>

面 j の膜の行を足す(同じ面の膜の行は置き換える)。names は構成ごとの膜の名前(空は膜なし)

Source

pub fn sync_active_config(&mut self)

表の今の構成の列を、系の今の値に合わせる(面の表・set で表の行の値を変えたとき。 OpticStudio で Lens Data の値を変えると Multi-Configuration Editor の今の構成の値も変わるのと同じ)

Source

pub fn insert_config( &mut self, at: usize, from: usize, pickup: bool, ) -> Result<(), Error>

構成を位置 at(1 始まり、1〜n+1)に挿入する。値は構成 from(挿入前の番号)の値。pickup なら各行の新しい構成を 構成 from のピックアップにする(OpticStudio の Insert Configuration with Pickups)。ピックアップの番号は付け替える。 今の構成は同じ構成を指したまま(番号はずれる)。表が無ければ構成 2 つの表を作る

Source

pub fn remove_config(&mut self, k: usize) -> Result<(), Error>

構成 k(1 始まり)を消す。k を元にするピックアップは値を残して外し、番号を付け替える。今の構成を消したら 次の構成(最後なら前)を系に入れる。構成が 1 つになったら表を消す(残った構成の値は系に入る)

Source

pub fn set_config_pickup( &mut self, p: Param, k: usize, from: usize, scale: f64, offset: f64, ) -> Result<(), Error>

表の行 p の構成 k を、構成 from の値 × scale + offset のピックアップにする(同じ構成のピックアップは置き換える)

Source

pub fn set_config_pickup_from( &mut self, p: Param, k: usize, row: Option<Param>, from: usize, scale: f64, offset: f64, ) -> Result<(), Error>

Self::set_config_pickup と同じだが、row があれば元の値は表の別の行 row の構成 from の値(OpticStudio の 構成のピックアップの元の行。row は p と同じ量の種類の行だけ、名前の行は不可。row なら from は k と同じでもよい。 OpticStudio が拾わない下の行・後の構成からのものは .zmx に値だけ書く)

Source

pub fn remove_config_pickup(&mut self, p: Param, k: usize) -> Result<(), Error>

表の行 p の構成 k のピックアップを外す(値は今のまま)

Source

pub fn remove_config_row(&mut self, p: Param) -> Result<(), Error>

表の行(パラメータ p)を消す。系の値は今のまま

Source

pub fn config(&self, k: usize) -> Result<System, Error>

構成 k(1 始まり)の値を入れた系(表は残し、今の構成を k にする)

Source§

impl System

Source

pub fn edit( &mut self, f: impl FnOnce(&mut Prescription) -> Result<(), Error>, ) -> Result<(), Error>

文書を f で直して作り直す: 面の値の確かめ、材料からの屈折率、ピックアップの解決、厚さのソルブ、 系の確かめ、自動の半直径。失敗なら元のまま

Source

pub fn edit_raw( &mut self, f: impl FnOnce(&mut Prescription) -> Result<(), Error>, ) -> Result<(), Error>

文書を f で直し、値はそのまま置く(ピックアップ・ソルブ・屈折率・自動の半直径は求め直さない)。 座標系・近軸量などは作り直し、系を確かめる。失敗なら元のまま(System::batch の中では系ごと捨てる)

ピックアップを解決し、ソルブを解き直す(System::edit_raw で足したピックアップ・ソルブを効かせる)。 座標系・近軸量などは作り直す

Source

pub fn add_glasses(&mut self, g: HashMap<String, Glass>)

ガラスを足す(同じ名前は置き換える)。屈折率は材料を設定したときに作る

Source

pub fn add_glass_catalogs( &mut self, names: &[String], dirs: &[PathBuf], ) -> Vec<String>

カタログ(AGF の名前、例 “SCHOTT”)を探す場所 dirs から読んで足す。見つからないカタログの名前を返す

Source

pub fn insert_surface(&mut self, at: usize, d: Surface) -> Result<(), Error>

面 at の前に面 d を入れる(at は 1〜像面)。d.n が空なら材料から屈折率を作る

Source

pub fn set_surface_fields( &mut self, j: usize, fields: &[(String, SurfValue)], ) -> Result<(), Error>

面 j の値をまとめて変える(名前は SURF_FIELDS。“r” は曲率半径で 0 なら平面、“type” は最初に当てる)。 厚さのソルブ・ピックアップで決まる値は変えられない。material は System::set_material と同じ

Source

pub fn surface_fields( &self, j: usize, ) -> Result<Vec<(&'static str, SurfValue)>, Error>

面 j の値(名前は SURF_FIELDS と “mirror”・“stop”・“n”)

Source

pub fn delete_surface(&mut self, j: usize) -> Result<Vec<String>, Error>

面 j(1〜像面の 1 つ前)を消す。消した面を参照するピックアップ・ソルブ・多重構成の行は外し、その説明を返す

Source

pub fn set_stop(&mut self, j: usize) -> Result<(), Error>

面 j を絞りにする

Source

pub fn set_surface_type(&mut self, j: usize, typ: SurfType) -> Result<(), Error>

面 j の種類を変える。種類で意味の変わる値(曲率・円錐係数・非球面、座標ブレークの値、傾き偏心)は、 新しい種類に無いものを 0 に戻す。形のデータの要る種類(Zernike・Grid Sag など)は、その面がすでに持つときだけ

Source

pub fn set_material(&mut self, j: usize, mat: &str) -> Result<(), Error>

面 j の材料(ガラス名・“nd,vd[,dpgf]”・空か AIR・MIRROR)を変える。dn・disp は残す

Source

pub fn set_coating(&mut self, j: usize, coat: &str) -> Result<(), Error>

面 j の膜(膜ファイルの名前、空で無し)

Source

pub fn set_aperture(&mut self, j: usize, ap: Aperture) -> Result<(), Error>

面 j の開口(Aperture::None で無し)

Source

pub fn add_pickup(&mut self, p: Pickup) -> Result<(), Error>

ピックアップを足す(同じ先・同じ量のものは置き換える)。先の値はすぐに元から決まる

Source

pub fn remove_pickup(&mut self, dst: usize, what: Kind) -> Result<(), Error>

面 dst の量 what のピックアップを外す(値は今の値のまま残る)。無ければエラー

Source

pub fn add_solve(&mut self, q: Solve) -> Result<(), Error>

ソルブ(厚さか曲率、crate::solves::SolveKind)を足す(同じ面・同じ量のものは置き換える)。値はすぐに解き直す

Source

pub fn add_macro_parm(&mut self, q: MacroParm) -> Result<(), Error>

円錐係数・半直径・機械半径・面タイプのパラメータの ZPL マクロのソルブ(crate::zpl_solve::MacroParm)を足す(同じ面・ 同じ量のものは置き換える)。マクロは [System::macros] の番号。値はすぐに解き直す

Source

pub fn remove_solve(&mut self, surf: usize, kind: Kind) -> Result<(), Error>

面 surf の量 kind(Kind::Thick か Kind::Curv)のソルブを外す(値は今のまま残る)。無ければエラー

Source§

impl System

Source

pub fn opl_grad( &self, t: &Trace, w: usize, params: &[Param], ) -> Result<Vec<f64>, Error>

面ごとの記録つきの追跡 t(record = true、波長 w)から、光線ごとの dOPL/dp を求める。 結果は光線ごとに params の順(行優先 [光線][パラメータ])。止まった光線は NaN

ピックアップ元のパラメータは、ピックアップ先が一緒に動いた分を含む(crate::param で変えたときと同じ)。 ピックアップ先のパラメータは、元とのつながりを無視した偏微分。

Source

pub fn trace_grad( &self, field: FieldSel, px: &[f64], py: &[f64], w: Option<usize>, last: Option<usize>, params: &[Param], ) -> Result<(Trace, Vec<f64>), Error>

視野の光線を追跡し、光線ごとの dOPL/dp も返す(System::opl_grad)

Source§

impl System

Source

pub fn from_import( rx: Prescription, macros: Vec<MacroRequest>, ) -> Result<System, Error>

読み手が作った文書 rx(ピックアップ・ソルブは書いたまま、値は解いていない)から系を作る。ピックアップを 解き、マクロのソルブの依頼 macros を順に今の系で試して付け、ソルブを解き直し、自動の半直径を光線から 求める(OpticStudio が読込でするのと同じ)。付けられないマクロは保存された値で固定し、理由を System::macro_warnings に残す

Source§

impl System

Source

pub fn land_grad( &self, t: &Trace, w: usize, params: &[Param], dz: Option<f64>, ) -> Result<Vec<f64>, Error>

面ごとの記録つきの追跡 t(全面の記録、波長 w)から、光線ごとの最後の面での d(x, y, l, m)/dp を求める。 dz を与えると、最後の面の局所座標の z = dz の平面での値(System::shift_end と同じ面)。 結果は行優先 [光線][パラメータ][x, y, l, m]。止まった光線は NaN。 ピックアップで一緒に動く面の分も足す(System::grad_with_pickups)

Source

pub fn shift_end( &self, t: &mut Trace, w: usize, dz: f64, ) -> Result<Vec<f64>, Error>

最後の面(t.last)の局所座標の z = dz の平面まで、追跡の結果 t を進める。位置 xyz・大域の p・ 光路長 opl(と OpticStudio の生の光路長)を書き換える。方向は変えない。記録(rec)は変えない。 平面はその面の座標系に固定(面の傾き・偏心に従い、その面の厚さには依らない)。 返り値は光線ごとの進んだ道のり(止まった光線は NaN)

Source

pub fn opl_grad_shift( &self, t: &Trace, w: usize, params: &[Param], dz: f64, g: &mut [f64], ) -> Result<(), Error>

dOPL/dp(System::opl_grad、最後の面の x・y を固定)を、最後の面から dz ずらした平面の x・y を固定した 微分に直す。g は opl_grad の結果([光線][パラメータ])。t は全面の記録つきの、ずらす前の追跡。 平面は最後の面の座標系に固定なので、剛体運動の寄与は打ち消し合い、最後の面の形と後の媒質の屈折率の分だけが残る。 ピックアップで一緒に動く面の分も足す

Source§

impl System

Source

pub fn lens_radius(&self, j: usize) -> f64

面 j の玉の半径(OpticStudio の Mech Semi-Dia): ガラスでつながる面(無視した面は飛ばしてつなぐ)の、縁の半径 (円形の開口の面は開口の最大の半径、ほかは半直径)+ チップゾーンと、固定した機械半径の最大(OpticStudio 26.1 で確認。 固定した値が自動より小さければ自動のまま)

Source

pub fn fixed_mech(&self, j: usize) -> f64

面 j の玉の、固定した機械半径の最大(無ければ 0)

Source

pub fn flat_from(&self, j: usize) -> f64

面 j の形が終わって平らになる半径(クリア半径 + チップゾーン)

Source§

impl System

Source

pub fn with_wavelength(&self, lam: f64) -> Result<(System, usize), Error>

波長 lam [µm] を末尾に重み 0 で足した系と、その波長の番号(0 始まり)。主波長・視野・エイミングは変えない。 媒質の屈折率は材料から作る(System::set_wavelengths と同じ)

Source§

impl System

Source

pub fn param(&self, spec: &str) -> Result<Param, Error>

パラメータを名前で: “3.t”、“L1 front.c”(面の名前.種類)、“objx”、“lens2.tx”(玉・群の名前.種類)。 unit: surf: を前に付けると玉・群か面かを決める

Source

pub fn param_name(&self, p: Param) -> String

パラメータの名前(玉・群は名前で)

Source

pub fn check_param(&self, p: Param) -> Result<(), Error>

パラメータがこの系で使えるか

Source

pub fn get_param(&self, p: Param) -> Result<f64, Error>

パラメータの今の値

Source

pub fn set_param(&mut self, p: Param, v: f64) -> Result<(), Error>

パラメータを変える。影響しないキャッシュ(座標系・近軸量)は残す

Source

pub fn set_params(&mut self, changes: &[(Param, f64)]) -> Result<(), Error>

まとめて変える(キャッシュの捨て方も 1 回で決める)。エラーのときは系を変えない

Source

pub fn with_params(&self, changes: &[(Param, f64)]) -> Result<System, Error>

複製してパラメータを変える(元の系のキャッシュのうち影響しないものを引き継ぐ) 自動の半直径も求め直す

Source

pub fn with_params_fast( &self, changes: &[(Param, f64)], ) -> Result<System, Error>

System::with_params で、自動の半直径を求め直さない(最適化・公差の差分など、半直径を使わない繰り返し用。 半直径は光線の追跡に効かない)

Source§

impl System

Source

pub fn pickup_of(&self, p: Param) -> Option<Pickup>

パラメータ p がピックアップ先ならそのピックアップ

Source§

impl System

Source

pub fn wave(&self, w: usize) -> Wavelength

波長 w(0 から)。範囲の外なら panic(wavelengths[w] と同じ)

Source§

impl System

Source

pub fn ray_heights(&self) -> Vec<Option<f64>>

面ごとの、全視野・全波長の主光線と瞳の縁の光線が通る高さ(面の局所座標の √(x²+y²))の最大。 物体面は有限なら物点の高さ、無限遠なら 0。どの光線も届かない面は None

Source

pub fn semi_affects_trace(&self) -> bool

自動の半直径が追跡に効くか: 自動の面に浮動開口がある(ける)、Irregular の面(半直径で正規化)、 自動の半直径を元にするピックアップ(曲率などを半直径から取るものも)、半径 0 のコバ厚のソルブ(半直径で測る)。最適化・公差の内側 (System::with_params_fast)はこのときだけ求め直す

Source

pub fn update_semi(&mut self)

自動の半直径の面(crate::surface::Surface::semi_auto)の半直径を光線から求め直す(Floating 開口の半径も)。 光線が届かない面は値を変えない。半直径のピックアップは解決し直す

Source

pub fn batch<R>( &mut self, f: impl FnOnce(&mut System) -> Result<R, Error>, ) -> Result<R, Error>

編集をまとめる: 系の複製 1 つに f を当て(中の編集は複製しない)、自動の半直径は(追跡に効かなければ) 最後に 1 回だけ求め直す。f が失敗を返せば元のまま。f の中で失敗した編集の後の系は途中まで変わっているので、 失敗は握りつぶさずに返すこと。半直径が追跡に効かないうちは、半直径は最後の系だけで決まるので編集ごとに求め直したときと同じ。 効く系(System::semi_affects_trace)では編集のたびに求め直す。今の半直径を読む編集(自動を外して固定する、 半直径を元にするピックアップを足す、半直径が追跡に効くようにする など)の前には、呼ぶ側が System::settle_semi で残りを求め直すこと

Source

pub fn settle_semi(&mut self)

System::batch の中で残っている自動の半直径の求め直しを今する(今の半直径を読む編集の前に)。外では何もしない

Source§

impl System

Source

pub fn solve_ray(&self, prob: &RayProblem) -> Result<RaySolution, Error>

未知数 2 つ・残差 2 つの実光線を Newton 法で解く

Source§

impl System

Source

pub fn n(&self, j: usize) -> &[f64]

面 j の後の媒質の屈折率(波長ごと、dn・disp 込み。鏡・座標ブレークは前の媒質)

Source

pub fn base_index(&self, j: usize, w: usize) -> f64

屈折率のずれ(dn・disp)をかける前の媒質の屈折率(面 j の後、波長 w)

Source

pub fn index_before(&self, j: usize, w: usize) -> f64

面 j の直前の媒質の屈折率

Source

pub fn image_index(&self, w: usize) -> f64

Source§

impl System

Source

pub fn without_vignetting(&self) -> System

ケラレ係数(VDX・VDY・VCX・VCY・VAN)を 0 にした複製。係数は座標系・近軸量に効かないのでキャッシュは残す (視野の掃引: OpticStudio の MTF vs Field・RMS vs Field は係数を使わない)

Source

pub fn prescription(&self) -> &Prescription

文書

Source

pub fn into_prescription(self) -> Prescription

文書を取り出す(共有していなければ写さない)

Source§

impl System

Source

pub fn new( surfaces: Vec<Surface>, wavelengths: Vec<f64>, weights: Vec<f64>, primary: usize, fields: Vec<Field>, field_type: FieldType, field_norm: FieldNorm, aperture: (ApertureKind, f64), telecentric: bool, aiming: Aiming, glasses: impl Into<Arc<HashMap<String, Glass>>>, ) -> Result<System, Error>

Source

pub fn check(&self) -> Result<(), Error>

Source

pub fn frames(&self) -> &Frames

Source

pub fn check_crystals(&self) -> Result<(), Error>

追跡できるか: 複屈折材の板の Mode 1・3(異常光の道)の中に、鏡・GRIN の媒質・屈折する面があると追跡しない (板の中は光線ごとの異常光の状態で進め、面での屈折・反射は入口と出口だけ扱う)。光線の追跡の入口 (System::try_trace・System::try_trace_into・偏光)がこれで断る

Source

pub fn validate(&self) -> Result<(), Error>

追跡の前に、未対応の項目がないかを確かめる(理想レンズの媒質など)

Source§

impl System

Source

pub fn field_norm_values(&self) -> (f64, f64)

Source

pub fn hxhy(&self, i: usize) -> (f64, f64)

視野 i の正規化座標(i は範囲の中。範囲の外は panic)

Source

pub fn vig_factors(&self, hx: f64, hy: f64) -> Result<[f64; 5], Error>

視野 (hx, hy) のケラレ係数 [VDX, VDY, VCX, VCY, VAN](視野の補間込み)。

既定(VigInterp::Continuous)は段差のない補間。VigInterp::OpticStudio なら OpticStudio 2026 R1.01 と 同じ規則(25 系 5010 点を ZOS-API で測って 2e-13 で一致):

  • 視野の物理座標 (X, Y) = 正規化視野 × 正規化の値(Radial は最大の半径、Rectangular は x・y それぞれの最大。 最大が 0 の向きは 0)
  • 全視野が x = 0 で y の符号がそろい、X² + Y² ≤ max|y|² なら、視野を |y| の順に並べ、r² = X² + Y² の区分線形で 補間する(r ではなく r²。最も内側の視野より内は、その視野の値)
  • それ以外(x ≠ 0 の視野がある、y の符号が混ざる、外側の点)は補間せず、物理座標の L1 距離 |X − x_i| + |Y − y_i| が最小の視野の値(同じ距離なら番号の小さい視野)
Source

pub fn object_spec(&self, hx: f64, hy: f64) -> Result<ObjSpec, Error>

物体の指定(無限遠: 方向、有限: 物体面の点)

Source

pub fn start_ray(&self, spec: ObjSpec, ex: f64, ey: f64) -> ([f64; 3], [f64; 3])

入射瞳面の点 (ex, ey) mm を通る光線の開始位置・方向(大域)

Source

pub fn stop_radius(&self) -> (f64, f64)

瞳座標 1 が狙う絞りの半径 (rx, ry)。符号つき: 入射瞳の上端を通る近軸光線が絞りで負の側に来る系 (入射瞳が物体より前の有限物体系など)では負(OpticStudio と同じく、px = 1 の光線が絞りの −x 側を通る)

Source§

impl System

Source

pub fn trace_spec( &self, spec: ObjSpec, px: &[f64], py: &[f64], w: usize, o: TraceOpts, ) -> Trace

物体の指定と瞳座標の光線を波長 w で追跡する(ケラレ係数・止める面・記録・視野は TraceOpts)

Source

pub fn pupil_ray(&self, spec: ObjSpec, v: [f64; 2]) -> ([f64; 3], [f64; 3])

物体 spec・入射瞳の座標 v(光線エイミングの未知数と同じ: 近軸の入射瞳の面の上の点 mm、物体の座標系)の光線の 開始位置・方向(大域。Launch::Rays で追う)。Launch::Pupil の光線は、瞳座標を Self::aim_pupil で v に直したもの

Source

pub fn aim_pupil( &self, spec: ObjSpec, p: [f64; 2], w: usize, ) -> Option<[f64; 2]>

物体 spec・正規化瞳座標 p(けられ係数・符号の反転なし)の光線の入射瞳の座標(Self::pupil_ray。エイミングは 系の設定どおりで、Launch::Pupil と同じ)。エイミングで解けなければ None

Source

pub fn aim_pupil_near( &self, from: ObjSpec, v0: [f64; 2], spec: ObjSpec, p: [f64; 2], w: usize, ) -> Option<[f64; 2]>

Self::aim_pupil で、近くの光線(物体 from・入射瞳の座標 v0。隣の視野・瞳の点)から解く(近くの光線を 1 本ずつ 続けて追う解析で、光線ごとに主光線の継続法から解き直さないため)。解けなければ None(そのときは Self::aim_pupil で解き直す)。エイミングの無い系は近軸の入射瞳の点

Source

pub fn pupil_reversed(&self) -> bool

有限物体で入射瞳が物体より前にあるか(ENPP + 物体距離 < 0)。このとき OpticStudio の瞳座標の光線は 入射瞳の点から遠ざかる向きになり、px = 1 は絞りの反対側を通る(Launch::Pupil の signed)

Source

pub fn object_frame(&self) -> Frame

物体の座標系(有限物体は物体面、無限遠物体は面 1 の変換の前の座標系)の原点と回転(大域)。 Launch::Rays に物体の座標系で与えた光線を大域に直すのに使う

Source

pub fn trace_launch<'r>( &self, l: &Launch<'_>, w: usize, last: Option<usize>, rec: impl Into<RecSel<'r>>, ) -> Trace

光線の始め方 l で追跡する(波長 w、面 last まで)。rec は記録する面(RecSel、bool なら全部か無し)。 面の多い系で一部の面だけ記録すると速い

Source

pub fn trace_pol_launch<'r>( &self, l: &Launch<'_>, w: usize, pol: PolIn<'_>, rec: RecSel<'r>, ) -> Result<PolTrace, Error>

光線の始め方 l での偏光追跡(Self::trace_pol_spec と同じ約束)。rec で面の交点も記録する

Source

pub fn trace_launch_into( &self, l: &Launch<'_>, w: usize, last: Option<usize>, buf: &mut RayBuf, )

光線の始め方 l で追跡し、結果を buf の列(buf.cols() の列と状態・けられ)に書く。 値は Self::trace_launch と同じビット。buf は呼び出しをまたいで使い回せる

Source

pub fn try_trace_into( &self, field: FieldSel, px: &[f64], py: &[f64], w: Option<usize>, last: Option<usize>, buf: &mut RayBuf, ) -> Result<(), Error>

視野の光線を瞳座標で追跡し、結果を buf の列に書く(Self::try_trace の列版、記録なし)

Source

pub fn try_trace<'r>( &self, field: FieldSel, px: &[f64], py: &[f64], w: Option<usize>, last: Option<usize>, rec: impl Into<RecSel<'r>>, ) -> Result<Trace, Error>

視野の光線を瞳座標 (px, py) で波長 w(既定は主波長)、面 last(既定は像面)まで追跡する。 rec は記録する面(RecSel、bool なら全部か無し)

Source§

impl System

Source

pub fn ptrace( &self, y1: f64, u0: f64, w: usize, upto: Option<usize>, ) -> (Vec<f64>, Vec<f64>)

面 1 の頂点面で高さ y1、物体空間の傾き u0 の近軸光線 → 各面の頂点面での高さ y と面の後の傾き u(展開した向き)

Source

pub fn ptrace_from( &self, from: usize, y1: f64, u0: f64, w: usize, upto: Option<usize>, ) -> (Vec<f64>, Vec<f64>)

面 from(1 以上)の頂点面で高さ y1、面の前の傾き u0 から始める近軸光線(System::ptrace と同じ形。 from より前の番号は NaN、物体面(番号 0)は from が 1 のときだけ値を持つ)。面の前の屈折率は System::index_before、from より前の鏡の数の偶奇を引き継ぐ

Source

pub fn paraxial(&self) -> &Paraxial

主波長の近軸量

Source

pub fn symmetric(&self) -> bool

座標ブレークや面の傾き偏心が面を軸から動かしていなければ true

Source

pub fn exit_pupil(&self) -> f64

射出瞳の位置(像面からその局所 z に沿って。OPD の基準)。回転対称なら近軸、そうでなければ OpticStudio と同じく小さい y 視野の実主光線が軸上主光線と交わる位置(2 視野で外挿)

Source

pub fn exit_pupil_diameter(&self) -> f64

射出瞳径(OpticStudio の EXPD)

Source

pub fn lens_conjugate(&self, j: usize) -> f64

理想レンズ j の近軸の物体距離(局所 z、進行方向に。無限大は平行光)

Source§

impl System

Source

pub fn pol_surfaces( &self, w: usize, coat: &Coatings, ) -> Result<Vec<PolSurf>, Error>

偏光追跡での面ごとの処理を波長 w について用意する(境界の係数、Jones 行列、媒質の吸収)

Source

pub fn try_trace_pol( &self, field: FieldSel, px: &[f64], py: &[f64], w: Option<usize>, pol: PolIn<'_>, ) -> Result<PolTrace, Error>

偏光追跡: 入力の偏光 pol.pols(物体の座標系の (Ex, Ey))ごとの電場を、最後の面の局所座標で返す。 pol.phase なら伝搬の位相 exp(−i k OPL) 込み(OpticStudio の偏光追跡と同じ約束)。phase = false なら 膜・境界・Jones 面の振幅と位相だけ(光路長は trace.rays[i].opl にある)

Source

pub fn trace_pol_spec( &self, spec: ObjSpec, px: &[f64], py: &[f64], w: usize, o: TraceOpts, pol: PolIn<'_>, ) -> Result<PolTrace, Error>

物体の指定(物点・方向)と瞳座標の偏光追跡(Self::try_trace_pol の物体を直接与える形)。 o はケラレ係数・止める面・面ごとの記録・視野(Self::trace_spec と同じ。o.vig が None なら視野 o.hxy のもの)

Source§

impl System

Source

pub fn find_unit(&self, name: &str) -> Option<usize>

玉・群を名前(大文字小文字は区別しない)で探す

Source

pub fn define_unit( &mut self, name: &str, spans: &[[usize; 2]], pivot: [f64; 3], ) -> Result<usize, Error>

玉・群を定義する(同じ名前の自動の玉は置き換える)。範囲は 1 ≤ 最初 ≤ 最後 < 像面、互いに重ならない。 ほかの玉・群とは、範囲が互いに含むか離れているかのどちらか

Source

pub fn rename_unit(&mut self, u: usize, name: &str) -> Result<(), Error>

玉・群の名前を変える(読込で作った玉も、変えれば利用者の定義になる)

Source

pub fn set_unit_spans( &mut self, u: usize, spans: &[[usize; 2]], ) -> Result<(), Error>

玉・群の範囲を変える(並びの位置・名前・回転の中心はそのまま)。動き・移動が 0 の玉・群だけ

Source

pub fn remove_unit(&mut self, u: usize) -> Result<Vec<String>, Error>

玉・群を外す(多重構成の表のその玉・群の行も外す)。動き・移動が 0 の玉・群だけ。説明を返す

Source

pub fn set_unit_pivot(&mut self, u: usize, pivot: [f64; 3]) -> Result<(), Error>

回転の中心を変える

Source

pub fn lens_units(&self) -> Vec<Unit>

読込で作る玉 lens1, lens2, …(玉モードの番号、crate::elements::split)。玉に分けられない系では空

Source

pub fn unit_media(&self, u: usize) -> Vec<usize>

玉・群の範囲の中の、媒質を持つ面(面の後がガラス。鏡・座標ブレーク・無視する面は除く)

Source

pub fn flatten_units(&self) -> Result<System, Error>

玉・群の剛体の動きを、範囲の前後に入れた座標ブレークにした系(面の番号が変わる。ピックアップ・ソルブ・ 玉・群の範囲は付け替える)。座標ブレークはなるべく厚さを持たせず偏心で動かすので、厚さの和(近軸量)は動かす前の 系と同じ。ただし回転が光軸を傾けないのに光軸方向へずらす必要がある場合(範囲の中に戻さない傾きがある玉の偏心など)は 座標ブレークに厚さが付き、近軸量がその分だけ動かした系(近軸量は動きを見ない)と違う。2 つ目からの 範囲の入口の向きが最初の範囲と違う玉・群は未対応

Source§

impl System

Source

pub fn source_rays( &self, src: &dyn SourceInstance, w: usize, ) -> Result<SourceRays, Error>

光源 src の波長番号 w(0 始まり)の光線を大域座標に直したもの(crate::system::Launch::Rays に渡せる)。 約束を守らない光線は誤り

Source§

impl System

Source

pub fn macro_warnings(&self) -> Vec<String>

マクロのソルブを外して保存された値で固定したもの(面・マクロの名前・理由)。空なら全部のマクロを解いている

Methods from Deref<Target = Prescription>§

Source

pub fn material_index(&self, mat: &Material) -> Result<Vec<f64>, Error>

媒質の屈折率(系の波長ごと、dn・disp をかける前)。ガラスは系のガラス(System::add_glasses で足せる)

Source

pub fn glass_nd_vd(&self, mat: &Material) -> Result<(f64, f64, f64), Error>

ガラス(系の温度・気圧・Adjust Index での値)かモデルガラスの d 線の屈折率・アッベ数・ΔPgF。 面の nd・vd のずれ(crate::surface::Surface::dnd・dvd、OpticStudio の TIND・TABB)の元の値

Source

pub fn surface_medium_index_at( &self, j: usize, lams: &[f64], ) -> Result<Option<Vec<f64>>, Error>

面 j の後の媒質の、波長 lams [µm] での屈折率(硝材の nd・vd のずれ dnd・dvd 込み、dn・disp をかける前)。 鏡・座標ブレークは None(前の媒質)

Source

pub fn material_index_at( &self, mat: &Material, lams: &[f64], ) -> Result<Vec<f64>, Error>

Prescription::material_index を波長 lams [µm] で

Source

pub fn find_surface(&self, target: &str) -> Result<usize, Error>

面を番号か名前(コメント、前後の空白と大文字小文字は区別しない)で探す。名前が複数の面にあれば不正

Source

pub fn dispersion_warnings(&self) -> Vec<String>

分散式の有効範囲(AGF の LD 行)の外の波長で屈折率を求めている材料の警告(面の番号・材料・波長・範囲)。 lensbench は式をそのまま延ばして計算する(OpticStudio は範囲外ではエラーにして屈折率を 1.0 にする)

Source

pub fn stop(&self) -> usize

Source

pub fn surf_label(&self, j: usize) -> String

エラーに添える面の名札: 「面 j(種類, 材料, 膜 名前, 「コメント」)」。空の項は省く

Source

pub fn image(&self) -> usize

Source

pub fn infinite(&self) -> bool

Source

pub fn image_point(&self, xyz: [f64; 3], lmn: [f64; 3]) -> (f64, f64)

像面での光線の点。ふつうは像面の局所座標 (x, y) mm。アフォーカル像空間では向きの角度 (atan(l/n), atan(m/n)) を [System::afocal_unit] の単位で(OpticStudio のスポットと同じ定義)

Source

pub fn image_unit(&self) -> &'static str

像面の点・周波数の単位の名前: ふつうは mm、アフォーカル像空間では角度の単位

Trait Implementations§

Source§

impl Clone for System

Source§

fn clone(&self) -> System

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for System

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Deref for System

Source§

type Target = Prescription

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Prescription

Dereferences the value.
Source§

impl<'de> Deserialize<'de> for System

Source§

fn deserialize<D>(d: D) -> Result<System, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for System

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn json_schema(g: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

impl Serialize for System

Source§

fn serialize<S>( &self, s: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl !Freeze for System

§

impl !RefUnwindSafe for System

§

impl !UnwindSafe for System

§

impl Send for System

§

impl Sync for System

§

impl Unpin for System

§

impl UnsafeUnpin for System

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,