Don't have an account? Register now to chat, post, use our tools, and much more.
Online Users
There are 121 users online: 4 members, 78 guests and 39 bots.
Members: geekboy1011.
Bots: VoilaBot (4), Spinn3r (1), Magpie Crawler (3), VoilaBot (12), Googlebot (19).
SAX
Author Message
ACagliano

Super-Expert

Joined: 08 Feb 2010
Posts: 922

 Posted: 28 Oct 2011 05:37:20 pm    Post subject: Angle Calculation Help I had an old program that I made in TI-Basic. I have wanted to convert it into z80 for a while. It was a Lewis Structures drawing program. It several shortcomings: (1) it could not handle drawing off-screen, and (2) It could only handle formulas with one central atom, and the others around it. (NH4, for instance). I want to redo this. In z80. So, I'm asking the following questions: 1. How do I calculate angle degrees in z80? When drawing Lewis Structures, spare electrons must be accounted for by leaving one space. For instance, in a water molecule, you know that it is a bent molecule. Because of the electrons left unbonded on the hydrogen, the oxygen molecules are pushed to the opposite side, at 90 degree angles to each other. Understand what I'm asking? Or maybe someone who knows more about this can explain better? 2. How do I make the program able to scroll to the left or right of the display in order to show offscreen parts? Would the DCS GUI features be best for this? Any help I could get would be great. I'd be willing to co-author the project with someone who knows how draw Lewis Structures , who could handle the technicalities of calculating and drawing._________________-ACagliano Current Projects Legend of Zelda. "Ganon's Rage" 51%
KermMartian

Joined: 14 Mar 2005
Posts: 55749
Location: Earth, Sol, Milky Way

 Posted: 30 Oct 2011 05:28:04 am    Post subject: What do you mean by calculating angle degrees, exactly? Turning radians into degrees? Turning degrees into X and Y? If you mean the latter, I have some fixed-point trigonometric routines from Obliterate that I could contribute to the project. For the second question, I definitely think the DCS GUI would be the best. Just construct the whole thing in an offscreen buffer, then use a scrollbar with callbacks to select which part is shown at a time._________________
seana11

Super-Expert

Joined: 23 May 2011
Posts: 833
Location: Well, the sign says "You are here"...

Posted: 30 Oct 2011 11:14:48 am    Post subject: Re: Angle Calculation Help

 ACagliano wrote: When drawing Lewis Structures, spare electrons must be accounted for by leaving one space. For instance, in a water molecule, you know that it is a bent molecule. Because of the electrons left unbonded on the hydrogen, the oxygen molecules are pushed to the opposite side, at 90 degree angles to each other. Understand what I'm asking? Or maybe someone who knows more about this can explain better?

I think I know what you're thinking of, but I have no Idea how to do it.
_________________

Code:
```-----BEGIN GEEK CODE BLOCK----- GCS d- s+: a---@ C+++ UL++ P L+++ E- W++ N o? K? w--- O? M-- V- PS++(--) PE- Y+ PGP t 5? X(+) R tv-- b++(+++) DI+(++) D(+) G e-(*)>++@ h! r!>+++ y? ------END GEEK CODE BLOCK------```
decoded
ACagliano

Super-Expert

Joined: 08 Feb 2010
Posts: 922

Posted: 30 Oct 2011 12:26:52 pm    Post subject:

 KermMartian wrote: What do you mean by calculating angle degrees, exactly? Turning radians into degrees? Turning degrees into X and Y? If you mean the latter, I have some fixed-point trigonometric routines from Obliterate that I could contribute to the project. For the second question, I definitely think the DCS GUI would be the best. Just construct the whole thing in an offscreen buffer, then use a scrollbar with callbacks to select which part is shown at a time.

By calculating degrees, I mean figuring out the x and y position to place a molecule, with respect to the central molecule.

For the second, I think I will use the DCS GUI, although I may be posting more questions as I get to that part.
_________________
-ACagliano

Current Projects

Legend of Zelda. "Ganon's Rage"
51%
souvik1997

Guru-in-Training

Joined: 19 Apr 2010
Posts: 2870

 Posted: 30 Oct 2011 12:41:29 pm    Post subject: If you have the coordinate for the central atom, you would use the unit circle to find points around it with an angle. Once you have routines for sine and cosine, it shouldn't be too hard._________________CALCnet Tournament-38% deviantArt
KermMartian

Joined: 14 Mar 2005
Posts: 55749
Location: Earth, Sol, Milky Way

Posted: 30 Oct 2011 05:09:36 pm    Post subject:

 souvik1997 wrote: If you have the coordinate for the central atom, you would use the unit circle to find points around it with an angle. Once you have routines for sine and cosine, it shouldn't be too hard.
Indeed, which is what I have and could give him. They're 16-bit fixed-point routines in 8.8 format, which means the first 8 bits is the integer part, and the section 8 bits is the decimal part. I wrote my routines and lookup tables in 4-degree increments, because that's all the precision I needed for the z80 version of Obliterate. It would be easy to modify the tables for more (or less) precision as needed.
_________________

ACagliano

Super-Expert

Joined: 08 Feb 2010
Posts: 922

 Posted: 30 Oct 2011 07:25:42 pm    Post subject: Thanks Kerm. To be honest, the only angles I really need to be able to draw are multiples of 360/8 (I think), since a valence orbital can only hold a maximum of eight electrons. Now, for any of you chemistry people here, how do you determine which atoms form the central atoms of the molecule or chain and which go around the central atoms? Oh, I need help with one routine. I need to parse a sector of memory from Label "ElementDataTable" forward. I need to look for a one or two byte search string. But the issue is this... take C and Co for example. If I search C, the element database lists it as "C_", where _ is a blank space. I can't have it return every element starting with C. 0x5._________________-ACagliano Current Projects Legend of Zelda. "Ganon's Rage" 51%
christop

Power User

Joined: 09 Mar 2011
Posts: 385
Location: Arizona, USA

Posted: 31 Oct 2011 11:14:37 pm    Post subject:

 ACagliano wrote: Thanks Kerm. To be honest, the only angles I really need to be able to draw are multiples of 360/8 (I think), since a valence orbital can only hold a maximum of eight electrons.

Just to throw in my two cents, I like to use a 256-entry sine/cosine table using what I call "byte degrees". Instead of radians or degrees, there are 256 byte degrees in a complete circle. Each entry is one byte containing the sine of the angle, scaled by 127. So sin(64)=127, sin(128)=0, sin(192)=-127, and so on. It's fairly easy to work with since everything fits in 8 bits (ie, a single register), and it has enough precision for decent graphics on a low-resolution calculator screen.

 Quote: Oh, I need help with one routine. I need to parse a sector of memory from Label "ElementDataTable" forward. I need to look for a one or two byte search string. But the issue is this... take C and Co for example. If I search C, the element database lists it as "C_", where _ is a blank space. I can't have it return every element starting with C. 0x5.

You're a little light on details on how the table is laid out, but if you search for a one-letter element name, you could add a space to the end of the search term and treat it like a two-letter name, and it will have only one match (the "C_" element in your example).

If you need more help with how to do the string search, we'll need to know more about the memory layout. Are the element symbols stored contiguously, such as "H_HeLiBeB_C_N_O_F_..."?
_________________
Christopher Williams
ACagliano

Super-Expert

Joined: 08 Feb 2010
Posts: 922

 Posted: 01 Nov 2011 08:20:51 am    Post subject: I no longer need help with the above...I can handle it. But, i do need to ask... DCS_GUI-wise. To render the molecule on the screen and have it scrollable, what GUI functions would I use? I know the horiz and vert scrollbars, but what sprite function would I use? Edit: Wait, I can't even do that, because the molecule is rendered on the basis of the molecule data. The molecule data has this format: byte 0 [Atomic number] byte 1 [# of lone pairs] byte 2 [charge] byte 3 [flags xx112234] byte 4 [bonded id 1] byte 5 [bonded id 2] byte 6 [bonded id 3] byte 7 [bonded id 4] byte 8 [bonded id 5] byte 9 [bonded id 6] byte 10 [display x] byte 11 [display y] Where bytes 10 and 11 control the position of that atom on the large buffer. And bytes 4-9 are pointers to the structures of the atoms bonded to that atom._________________-ACagliano Current Projects Legend of Zelda. "Ganon's Rage" 51%
KermMartian

Joined: 14 Mar 2005
Posts: 55749
Location: Earth, Sol, Milky Way

 Posted: 04 Nov 2011 12:58:44 am    Post subject: Would you mind helping me understand where the question is in all that? I see you asked about a sprite routine, but then you seem to have gone on to detail the structure of your database._________________
ACagliano

Super-Expert

Joined: 08 Feb 2010
Posts: 922

Posted: 04 Nov 2011 08:15:42 am    Post subject:

 KermMartian wrote: Would you mind helping me understand where the question is in all that? I see you asked about a sprite routine, but then you seem to have gone on to detail the structure of your database.

Oh, fail. Basically, my question is...taking into account the fact that the data is formatted as such, not as an actually buffer, it would be impractical to use the DCS drawing routines, am I right?
_________________
-ACagliano

Current Projects

Legend of Zelda. "Ganon's Rage"
51%
KermMartian

Joined: 14 Mar 2005
Posts: 55749
Location: Earth, Sol, Milky Way

Posted: 04 Nov 2011 07:06:38 pm    Post subject:

ACagliano wrote:
 KermMartian wrote: Would you mind helping me understand where the question is in all that? I see you asked about a sprite routine, but then you seem to have gone on to detail the structure of your database.

Oh, fail. Basically, my question is...taking into account the fact that the data is formatted as such, not as an actually buffer, it would be impractical to use the DCS drawing routines, am I right?
I don't agree with you there. It's quite easy to render arbitrary graphics into a temporary memory buffer somewhere, then push that into the GUIStack as a sprite. I do that trick in many programs, including Document DE and Sandpaper.
_________________

arriopolis

New Member

Joined: 29 Mar 2011
Posts: 92

Posted: 06 Nov 2011 03:22:48 pm    Post subject: Re: Angle Calculation Help

 ACagliano wrote: the oxygen molecules are pushed to the opposite side, at 90 degree angles to each other.

Sure about that? My BINAS (Book full of tables used alot in the Netherlands) says "bondingsangle" between H-O-H is 104.5º.
ACagliano

Super-Expert

Joined: 08 Feb 2010
Posts: 922

Posted: 06 Nov 2011 04:56:28 pm    Post subject: Re: Angle Calculation Help

arriopolis wrote:
 ACagliano wrote: the oxygen molecules are pushed to the opposite side, at 90 degree angles to each other.

Sure about that? My BINAS (Book full of tables used alot in the Netherlands) says "bondingsangle" between H-O-H is 104.5º.

I know. I was just giving an example.

Can anyone here tell me, what is used to determine what molecules go in the central atom/central chain, given only a formula? And, I know about VESPR, but this program is all inclusive...I want it to work regardless of HOW you input the formula. There has to be something. Valence electron count. Electronegativity.
_________________
-ACagliano

Current Projects

Legend of Zelda. "Ganon's Rage"
51%
arriopolis

New Member

Joined: 29 Mar 2011
Posts: 92

 Posted: 06 Nov 2011 05:03:09 pm    Post subject: The nice thing about molecules is that they have multiple structural formulas for one moleculair formula. Those different molecules are called "isomeres" (at least they do in the Netherlands). For example, if you have "butaan", C4H10, that comes in: Code: ```  H H H H         H H H H-C-C-C-C-H and H-C-C-C-H   H H H H         H | H                   H-C-H                     H``` This means that there is really no way you can draw a structural formula based on the moleculair formula. Edit: this is what I thought you wanted to make, correct me if I'm wrong.
KermMartian

Joined: 14 Mar 2005
Posts: 55749
Location: Earth, Sol, Milky Way

 Posted: 15 Nov 2011 09:14:00 am    Post subject: (We call that "Butane" ). And indeed, the chemical formula doesn't tell you much about the structure of a particular molecule, unfortunately._________________
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
 Page 1 of 1 » All times are GMT - 5 Hours

 Jump to: Select a forum Announcements----------------Cemetech AnnouncementsCemetech LabsContests General Discussion----------------Technology & Calculator Open Topic-- Electronics/Hardware Development-- Calculator HardwareYour ProjectsGeneral Open Topic-- Politics & Rants-- Reviews-- Humour/Jokes Cemetech's Projects----------------Doors CSSourceCoderMember Features-- TI-Freak8x-- Merthsoft-- GrammerOther & Upcoming Projects-- The BASIC Elite-- mobileTunes-- CALCnet 2.2-- SuggestionsProgramming the TI-83 Plus/TI-84 PlusUsing the TI-83 Plus/TI-84 PlusWebsite Programming & Design----------------General Programmingz80 AssemblyTI-BASICCasio Prizm/FX Development & ProgrammingWebsite Markup & ScriptingGraphics1337 Programming Tips Building with Blocks----------------FreeBuild, LEGO, and Minecraft-- FreeBuild General-- Suggestions & Troubleshooting-- Content & Gallery-- Servers & Activities
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.038054 seconds.