User Tools

Site Tools


blog:2020-11-08:geogebra_plugin

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
blog:2020-11-08:geogebra_plugin [2020/11/08 09:06] – [Wave Addition] va7fiblog:2020-11-08:geogebra_plugin [2021/01/03 08:08] (current) va7fi
Line 1: Line 1:
 ====== Geogebra Plugin ====== ====== Geogebra Plugin ======
-I created a plugin to embed [[https://www.geogebra.org/ |Geogebra]] files since the current Geogebra plugins are all too old and don't work.  See [[https://wiki.geogebra.org/en/Reference:GeoGebra_Apps_Embedding |here]] for general Geogebra embedding instructions.+[[https://www.geogebra.org/ |Geogebra]] is a graphing and geometry tool I've been using since my teaching days.  I always found it to be very useful to display concepts that are hard to visualize on a static page However, it is a lot more than a simple animation since people can interact with it and move things around.
  
-This is my first plugin and a bit of a cheat: I basically took the [[https://www.dokuwiki.org/plugin:color |Color plugin]] and modified it until it did what I needed.  However, there's still a lot of code that I don't really understand and a few features that are missing.+In the past, I had to export Geogbra files to html5 to embed them, but the process was pretty clunky and time consuming. I searched the Dokuwiki plugins but all the ones listed are too old and don't work anymore.  Finally, I created my own using some general instructions for [[https://wiki.geogebra.org/en/Reference:GeoGebra_Apps_Embedding |embedding Geogebra files]].  This is my first plugin and a bit of a cheat: I basically took the existing [[https://www.dokuwiki.org/plugin:color |Color plugin]] which is pretty simple, studied it to learn a bit of the syntax and modified it until it did what I needed.  However, there's still a lot of code that I don't really understand and a few features that are missing.
  
-Here'how I installed it:+Here'what got so far.  If anyone has experience writing Dokuwiki plugin, please [[patoo@rbox.me |reach out]]. 
 + 
 +Here's how to installed it:
 <hidden> <hidden>
-  * Add the following three files in the wiki folder: ''./lib/plugins/ggb/''+  * Add the following three files in the wiki folder: ''./lib/plugins/ggb2/''
   * ''manager.dat''<code>   * ''manager.dat''<code>
 installed=Sun, 08 Nov 2020 08:20:00 -0800</code> installed=Sun, 08 Nov 2020 08:20:00 -0800</code>
   * ''plugin.info.txt''<code>   * ''plugin.info.txt''<code>
-base   ggb+base   ggb2
 author Patrick Truchon author Patrick Truchon
 email  patoo@rbox.me email  patoo@rbox.me
 date   2020-11-08 date   2020-11-08
 name   geogebra6 syntax plugin name   geogebra6 syntax plugin
-desc   Include GeoGebra6 files into Dokuwiki</code>+desc   Embeds GeoGebra 6 files into Dokuwiki</code>
   * ''syntax.php''<code php>   * ''syntax.php''<code php>
 <?php <?php
 /** /**
- * Plugin ggb: Embeds Geogebra files into Dokuwiki.+ * Plugin ggb2: Embeds Geogebra files into Dokuwiki.
  *  *
  * @license    GPL 3 (http://www.gnu.org/licenses/gpl.html)  * @license    GPL 3 (http://www.gnu.org/licenses/gpl.html)
Line 36: Line 38:
  * need to inherit from this class  * need to inherit from this class
  */  */
-class syntax_plugin_ggb extends DokuWiki_Syntax_Plugin {+class syntax_plugin_ggb2 extends DokuWiki_Syntax_Plugin {
  
     function getType(){ return 'substition'; }     function getType(){ return 'substition'; }
     function getSort(){ return 306; }     function getSort(){ return 306; }
-    function connectTo($mode) { $this->Lexer->addSpecialPattern('{{ggb>.*?}}',$mode,'plugin_ggb'); }+    function connectTo($mode) { $this->Lexer->addSpecialPattern('{{ggb>.*?}}',$mode,'plugin_ggb2'); }
  
  
Line 99: Line 101:
  
 The syntax is:<code> The syntax is:<code>
-{{ggb>path/to/geogebrafile.ggb 740,300}}</code>+{{ggb>/path/to/geogebrafile.ggb 740,300}}</code>
  
 Note that at the moment, if a path is used, it must use ''/'' instead of '':'' The default dimensions are 800x400 if they are omitted. Note that at the moment, if a path is used, it must use ''/'' instead of '':'' The default dimensions are 800x400 if they are omitted.
Line 109: Line 111:
 When two waves overlap, they add up together at every point.  Here, the <fc #4682b4>blue</fc> and <fc #008000>green</fc> waves are generated and add up together to form the <fc #ff0000>red</fc> wave.  You can move the blue and green waves and see the result.  To convince yourself that the red wave is really the sum of the blue and green waves, look at points <fc #4682b4>A</fc>, <fc #008000>B</fc>, and <fc #ff0000>C</fc> You  can move the blue or green waves by sliding their phase (<fc #4682b4>φ</fc> and <fc #008000>Φ</fc>) around.  You'll see that point <fc #ff0000>C</fc> is always the sum of <fc #4682b4>A</fc> and <fc #008000>B</fc>. When two waves overlap, they add up together at every point.  Here, the <fc #4682b4>blue</fc> and <fc #008000>green</fc> waves are generated and add up together to form the <fc #ff0000>red</fc> wave.  You can move the blue and green waves and see the result.  To convince yourself that the red wave is really the sum of the blue and green waves, look at points <fc #4682b4>A</fc>, <fc #008000>B</fc>, and <fc #ff0000>C</fc> You  can move the blue or green waves by sliding their phase (<fc #4682b4>φ</fc> and <fc #008000>Φ</fc>) around.  You'll see that point <fc #ff0000>C</fc> is always the sum of <fc #4682b4>A</fc> and <fc #008000>B</fc>.
  
-{{ggb>howto/hambasics/sections/waveaddition.ggb 800,500}}+{{ggb>/howto/hambasics/sections/waveaddition.ggb 800,500}}
  
  
Line 116: Line 118:
   * the red wave is cancelled out?((Fun fact: This is how [[wp>Active_noise_control |noise cancelling headphones]] work.  The headset has a microphone that picks up the noise, inverts the waves, and plays them back in the ear piece.  The combination of the real life noise and the inverted noise being played in the speaker cancel out (somewhat).))   * the red wave is cancelled out?((Fun fact: This is how [[wp>Active_noise_control |noise cancelling headphones]] work.  The headset has a microphone that picks up the noise, inverts the waves, and plays them back in the ear piece.  The combination of the real life noise and the inverted noise being played in the speaker cancel out (somewhat).))
  
-If you press the play button on the bottom left corner, you'll see the blue wave travel to the right and the green wave travel to the left.  The red wave oscillates up and down but doesn't travel anywhere.  This is called a //standing wave// (SWR).  While the animation is running, slowly decrease the amplitude of the reflected wave (B) and you'll see that the red wave (which is what actually makes it to the antenna), starts moving to the right.+If you press the play button on the bottom left corner, you'll see the blue wave travel to the right and the green wave travel to the left.  The red wave, which is the sum of the forward and reflected waves, oscillates up and down but doesn't travel anywhere, which means it's not going into the antenna. 
 + 
 +While the animation is running, slowly decrease the amplitude of the reflected wave (<fc #008000>V<sub>B</sub></fc>) and you'll see that the red wave will start moving to the right.  As you do that, notice how the SWR (Standing Wave Ratiodecreases toward 1:1.  At this pointthere is no reflected wave and all of the energy is going to the antenna (assuming no loss in the feedline) 
  
blog/2020-11-08/geogebra_plugin.1604855189.txt.gz · Last modified: 2020/11/08 09:06 by va7fi