fan-shaped optical beam source

12 views
Skip to first unread message

Jonathan Lee

unread,
Jan 5, 2026, 12:03:41 AMJan 5
to mcx-users

Dear Dr. Fang,

I hope you are doing well. First of all, thank you very much for developing and maintaining MCX. It has been extremely valuable for our optical and biomedical simulations.

I am writing to ask about the possibility of supporting a fan-shaped optical beam source in MCX, or whether you think such a feature could be reasonably added in the future.

Specifically, the use case is analogous to a collimated beam passing through a cylindrical lens, resulting in:

  • negligible (or zero) divergence in one transverse direction (e.g., x),

  • strong divergence in the orthogonal direction (e.g., y), for example a 90° full-angle fan,

  • with an arbitrary spatial intensity profile at the entrance plane (e.g., elliptical Gaussian).

At present, MCX source types such as cone, zgaussian, and Lambertian sources appear to assume azimuthally symmetric angular distributions, so they inherently spread in both transverse directions. While workarounds such as multiple runs with swept source directions are possible, a native “fan beam” or anisotropic angular distribution source would be very helpful and more efficient.

Conceptually, this could be implemented as:

  • independent angular distributions in two orthogonal planes (e.g., fixed dx = 0, sampled dy/dz),

  • or a source that samples directions within a defined angular interval in a single plane (y–z), similar to a cylindrical-lens model.


I would be very interested to hear your thoughts on:

  • whether MCX’s current source framework could support this kind of anisotropic angular sampling, and

  • whether you think such a feature might fit within MCX’s design philosophy.

Thank you again for your time.

Best regards,
J. Lee

Fang, Qianqian

unread,
Jan 11, 2026, 1:40:46 PMJan 11
to mcx-users
Hi Jonathan,

Sorry for the delay.

mcx has a Gaussian-broadened slit-source option,  contributed by Liam Keegan in this PR:


When you define cfg.srcparam2.{x,y}, it broadens a slit source using an Gaussian profile in x and y - otherwise, slit is a thin plane.


I just made another commit to extend the line source to create a "wedge-beam" - if cfg.srcparam2.x is defined, it defines a half-angle, in radians, rotates above and below the plane defined by cfg.srcdir and the line-source-axis (cfg.srcparam1.xyz). Otherwise, line-source emit isotopically around the line in the perpendicular direction.


If you make cfg.srcparam1 to be a very short vector (but not zero), it should make a flat fan-shaped beam instead of a wedge, if you need it to be flat.

Once you compiled and updated your mcxlab, you can try this code in matlab and see the beam profile

cfg=mcxcreate('cube60');
cfg.prop(2,:)=[0.001,0,1,1.3];
cfg.srctype='line';
cfg.srcpos=[30,30,10];
cfg.srcdir=[1,1,0]/sqrt(2);
cfg.srcparam1=[10,10,20];
cfg.srcparam2=[pi/20,0,0,0];
cfg.nphoton=1000;
cfg.debuglevel='T';
traj = mcxlab(cfg);
mcxplotphotons(traj)


also try the Gaussian-broadened slit source and see if these could be relevant to your simulations.


From: mcx-...@googlegroups.com <mcx-...@googlegroups.com> on behalf of Jonathan Lee <lee...@gmail.com>
Sent: Monday, January 5, 2026 12:02 AM
To: mcx-users <mcx-...@googlegroups.com>
Subject: [mcx-users] fan-shaped optical beam source
 
You don't often get email from lee...@gmail.com. Learn why this is important
--
You received this message because you are subscribed to the Google Groups "mcx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mcx-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mcx-users/62add129-8d1a-40d9-acbc-502bd4520af0n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages