Skip to main content

Thread: [Python] Class methods vs functions


i ask general guidance on question.

i'm working on project build optical ray-tracing program. not same graphics package, such pov-ray, models ray propagation in lens system. eventual goal gui-driven program easy use in educational environment, or fast first-order design tool in non-critical applications.

core of program sequential surface object. approach treats lens system sequence of spaces , surfaces. object belongs custom class writing.

creating class takes information describing sequence of spaces (lengths , indices of refraction) , surfaces (curvatures). class calculates matrices representing each element, , 1 matrix representing whole system.

point of internal contention have encountered other functions should include class methods, , functions should defined externally. example, function returns position of each ray @ every surface in system rather final position? or functions compute other alternative representations (such gaussian reduction or cardinal points , planes)? or functions compute propagation in different way (tnyu trace instead of abcd matrices)? partial or reverse propagation?

there guidance on should distinguish method function?

quote posted erdaron view post
is there guidance on should distinguish method function?
define classes first. have lenses bend light rays, or light rays bent lenses? can define generic lens can either simplelens or compositelens, , can define compositelens association of 2 lens (simple or composite) , distance... once have right classes, methods sort of come out naturally...


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [Python] Class methods vs functions


Ubuntu

Comments

Popular posts from this blog

Upgrade 3.4.8 to 3.5.1 failed "download package failed" - Joomla! Forum - community, help and support

Fatal error during instalation - Joomla! Forum - community, help and support

Joomal 3.6.3 update error - PHP temporary folder is not set - Joomla! Forum - community, help and support