Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline sinneD  
#1 Posted : 11 July 2018 00:59:22(UTC)
sinneD


Rank: Advanced Member

Groups: Registered
Joined: 12/03/2011(UTC)
Posts: 101
Location: Chicago

Was thanked: 16 time(s) in 7 post(s)
I have an include file with a bunch of functions and variable definitions in it. Within one of my functions is a 'cases' and a bunch of if/thens that makes it REALLY long.

Are better ways to script or format the syntax for something like this? The sheer vertical size of this trips me up sometimes and I need to get my bearigns to navigate it.

Thanks

Dennis

include-detail.png




Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Jean Giraud  
#2 Posted : 11 July 2018 03:13:29(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: sinneD Go to Quoted Post
Are better ways to script or format the syntax for something like this ?


For horizontal, use if/otherwise instead of if/else
Open the collapsed area [mapR(x), mapG(x),mapB(x)].

Image Rainbow Colormap [Electron].sm (253kb) downloaded 15 time(s).

Offline sinneD  
#3 Posted : 11 July 2018 04:09:10(UTC)
sinneD


Rank: Advanced Member

Groups: Registered
Joined: 12/03/2011(UTC)
Posts: 101
Location: Chicago

Was thanked: 16 time(s) in 7 post(s)
Jean Giraud-

THANK YOU! that will help me make things so much cleaner. I need to take some time to get my head around the way I have it now to clean up.

Question- at the value of say 64, do the sucessive (32≤x)&(x≤64) and (64≤x)&(x≤96) have a conclict? should one of those terms be a less than instead of a less than or equal too operator?

Dennis
Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline Jean Giraud  
#4 Posted : 11 July 2018 05:22:22(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: sinneD Go to Quoted Post
Question- at the value of say 64, do the sucessive (32≤x)


... can't tell w/o the document. On top, you complicate matters
Can't you mange f(x) ... linterp(X,Y,x)
... or part of the document that produces something.
Offline sinneD  
#5 Posted : 11 July 2018 17:19:35(UTC)
sinneD


Rank: Advanced Member

Groups: Registered
Joined: 12/03/2011(UTC)
Posts: 101
Location: Chicago

Was thanked: 16 time(s) in 7 post(s)
Jean Giraud-

My question is about the bolean expressions in your example, within the mapR(x) section. Two sucessive expressions have a common intersection point throughout.

1. The upper limit of the first expression is a less than or equal evaluation of a number.

2. The lower limit of the next expression is a greater than or equal to the same number.

What happens when the value for the expression is exactly equal to the number?

I thought only one of the two expressions could be an 'equal to' statement at the same limit point.

Dennis

Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline Jean Giraud  
#6 Posted : 11 July 2018 19:14:55(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
... mistakes in the last two posts, deleted.
The two segments for interpolation.

Dennis.sm (12kb) downloaded 14 time(s).
Offline sinneD  
#7 Posted : 14 July 2018 03:44:53(UTC)
sinneD


Rank: Advanced Member

Groups: Registered
Joined: 12/03/2011(UTC)
Posts: 101
Location: Chicago

Was thanked: 16 time(s) in 7 post(s)
Jean Giraud-
Thanks for that explanation. I actually learned a whole bunch more functions from that too!
Dennis
Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline oscampo  
#8 Posted : 14 July 2018 07:54:32(UTC)
oscampo


Rank: Advanced Member

Groups: Registered
Joined: 10/12/2009(UTC)
Posts: 246
Man
Colombia
Location: Cali, Colombia

Was thanked: 85 time(s) in 65 post(s)
Originally Posted by: sinneD Go to Quoted Post
I have an include file with a bunch of functions and variable definitions in it. Within one of my functions is a 'cases' and a bunch of if/thens that makes it REALLY long.

Are better ways to script or format the syntax for something like this? The sheer vertical size of this trips me up sometimes and I need to get my bearigns to navigate it.



You can use areas to separate portions of code.

As an example, please, look this game that I developed and has a lot of lines of code

Regards!
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.