yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] Canguy247:
Fat arrows

This one draws a large, hollow arrow, using acadoid's snap-to-grid code:

width = LN.getWidth();
height = LN.getHeight();
scale = LN.getScale();
step = width / 150 + scale * width / 25;
x1 = LN.getX1();
y1 = LN.getY1();
x2 = LN.getX2();
y2 = LN.getY2();
x1g = (step / 2) + Math.floor((x1 - (step / 2)) / step + 0.5) * step;
y1g = (step / 2) + Math.floor((y1 - (step / 2)) / step + 0.5) * step;
x2g = (step / 2) + Math.floor((x2 - (step / 2)) / step + 0.5) * step;
y2g = (step / 2) + Math.floor((y2 - (step / 2)) / step + 0.5) * step;

arrowLength=Math.sqrt((x2g-x1g)*(x2g-x1g)+(y2g-y1g)*(y2g-y1g));
theta=Math.atan((y2g-y1g)/(x2g-x1g));
if (x2g>=x1g) {
xa=-0.2* arrowLength*Math.sin(theta)+x1g;
ya=0.2*arrowLength*Math.cos(theta)+y1g;
xb=0.2* arrowLength*Math.sin(theta)+x1g;
yb=-0.2*arrowLength*Math.cos(theta)+y1g;
xc=0.6*arrowLength*Math.cos(theta)+0.2* arrowLength*Math.sin(theta)+x1g;
yc=0.6*arrowLength*Math.sin(theta)-0.2*arrowLength*Math.cos(theta)+y1g;
xd=0.6*arrowLength*Math.cos(theta)+0.4* arrowLength*Math.sin(theta)+x1g;
yd=0.6*arrowLength*Math.sin(theta)-0.4*arrowLength*Math.cos(theta)+y1g;
xe=arrowLength*Math.cos(theta)+x1g;
ye=arrowLength*Math.sin(theta)+y1g;
xf=0.6*arrowLength*Math.cos(theta)-0.4* arrowLength*Math.sin(theta)+x1g;
yf=0.6*arrowLength*Math.sin(theta)+0.4*arrowLength*Math.cos(theta)+y1g;
xg=0.6*arrowLength*Math.cos(theta)-0.2* arrowLength*Math.sin(theta)+x1g;
yg=0.6*arrowLength*Math.sin(theta)+0.2*arrowLength*Math.cos(theta)+y1g;
}
else {
xa=x1g-(-0.2* arrowLength*Math.sin(theta));
ya=y1g-(0.2*arrowLength*Math.cos(theta));
xb=x1g-(0.2* arrowLength*Math.sin(theta));
yb=y1g-(-0.2*arrowLength*Math.cos(theta));
xc=x1g-(0.6*arrowLength*Math.cos(theta)+0.2* arrowLength*Math.sin(theta));
yc=y1g-(0.6*arrowLength*Math.sin(theta)-0.2*arrowLength*Math.cos(theta));
xd=x1g-(0.6*arrowLength*Math.cos(theta)+0.4* arrowLength*Math.sin(theta));
yd=y1g-(0.6*arrowLength*Math.sin(theta)-0.4*arrowLength*Math.cos(theta));
xe=x1g-(arrowLength*Math.cos(theta));
ye=y1g-(arrowLength*Math.sin(theta));
xf=x1g-(0.6*arrowLength*Math.cos(theta)-0.4* arrowLength*Math.sin(theta));
yf=y1g-(0.6*arrowLength*Math.sin(theta)+0.4*arrowLength*Math.cos(theta));
xg=x1g-(0.6*arrowLength*Math.cos(theta)-0.2* arrowLength*Math.sin(theta));
yg=y1g-(0.6*arrowLength*Math.sin(theta)+0.2*arrowLength*Math.cos(theta));
}
xmin = Math.min(xa, xb, xc, xd, xe, xf, xg);
ymin = Math.min(ya, yb, yc, yd, ye, yf, yg);
xmax = Math.max(xa, xb, xc, xd, xe, xf, xg);
ymax = Math.max(ya, yb, yc, yd, ye, yf, yg);
LN.setClip(xmin, ymin, xmax, ymax);
LN.drawLine(xa, ya, xb, yb);
LN.drawLine(xc, yc, xb, yb);
LN.drawLine(xc, yc, xd, yd);
LN.drawLine(xe, ye, xd, yd);
LN.drawLine(xe, ye, xf, yf);
LN.drawLine(xf, yf, xg, yg);
LN.drawLine(xg, yg, xa, ya);
[Android Apps and Games] acadoid:
[MENTION=4226212]Tintinnuntius[/MENTION] & Canguy247: Many thanks for posting the codes!

[MENTION=4226212]Tintinnuntius[/MENTION]: I actually thought that nobody would use all six parameters... More parameters can be added, I will increase the maximal number to ten. Anticipating your question: There has to be a maximal number of parameters due to the Android dialog resources.
[Android Apps and Games] Canguy247:
Many thanks and a request/suggestion

First I want to say THANK-YOU to acadoid for this wonderful addition. It has surpassed my expectations.

Next, I would like to make a suggestion. These tools open the possibility for libraries (which I think You were considering in the other thread). My suggestion is to adjust the interface to allow 2 libraries to be loaded at a time with a simple dropdown or arrows to switch between installed libraries. That would allow someone to load a library, which can be customized by picking tools from other libraries, which does all of the most comkon things they need such as bullets and boxes. They could then have the second library which they can switch depending on their task. This way we could build libraries of schematic symbols for electronics, or flowchart symbols, or pukps and valves and the user could switch depending on their use at the time.

Also, it would be great if the custom tools were represented by pictures instead of numbers, but I see the difficulty in making this practical.

Finally, is it possible to have a small status bar as part of the floating tool widget which tells the user what tool/library is selected?

And thanks again!
[Android Apps and Games] Tintinnuntius:
How about at least replacing numbers by a 2-letter code (that would still fit in the small window and be easily legible). The code is something one could specify while scripting the tool (just an extra input next to the box that lets you name the tool) and it would be easier to remember. For example:

- T for a table,

- Pn for a polygon on n vertices,

- sd for a tool that calculates the standard deviation of given data,

- ...

instead of

- 1 for a table,

- 13 for a polygon on n vertices,

- 5 for a tool that calculates the standard deviation of given data,

- ...

The toolbox would then look like a tiny periodic table :)
[Android Apps and Games] acadoid:
[MENTION=5144453]Canguy247[/MENTION]: You are not the first to suggest container/groups/libraries for custom drawing tools. I have that on my to-do-list.

I am also considering to allow small icons. The problem is not the icons of the custom drawing tools that LectureNotes ships with, but the custom drawing tools that users define. Note that there is also a drawing tools menu in which you can select drawing tools and custom drawing tools by name.

[MENTION=4226212]Tintinnuntius[/MENTION]: Letters or double-letters might be an option, but I guess that a small icon is better, isn't it?
[Android Apps and Games] Tintinnuntius:
An icon is better, of course. Would we be able to design and import our own? Or even better, just cut it from LN notebook.
[Android Apps and Games] acadoid:
[MENTION=4226212]Tintinnuntius[/MENTION]: The question of how to handle the icons is what makes adding these icons a bit complicated.
[Android Apps and Games] claytonjn:
I don't know if this would work or not, but could you just develop an algorithm to use the javascript code for each tool to generate the icons for that tool automatically?
[Android Apps and Games] Tintinnuntius:
I've come across a funny bug in the pencil toolbox. If both the standard and custom tools are shown, the numbers for custom tools are nice and thin, but if the standard tools are removed, the numbers for custom tools get all fat :)
[Android Apps and Games] flamer90:
Hi.

I'd like to revive the thread a little as I found it to be VERY(!) useful.

I'm looking for a code for a dashed circle, could you/someone else help?
[Android Apps and Games] acadoid:
[MENTION=2403121]flamer90[/MENTION]: Have a look at the examples for `dashed line´ and `circle´ that come with LectureNotes (you cannot edit the examples, but you can clone them and edit the cloned tool).
[Android Apps and Games] Ronnysade:
Hii i need hexagonal drawong tool to lacturenote, please
[Android Apps and Games] acadoid:
[MENTION=9807194]Ronnysade[/MENTION]: How exactly should the hexagon been drawn? First point is center and second point is one corner?

If you need hexagons of fixed size and orientation, I recommend to use an image instead. LectureNotes has a `paste from non-standard clipboard´ item in the `cutter´ menu. The material to choose from is collected from several locations, for instance the `Download´ and `Pictures´ folder, including sub-folders.
[Android Apps and Games] kasp6094:
Hello! :)

I'm studying marine engineering and would love to be able to draw vectors with given lengths and angles.

I this possible?

Best regards!
[Android Apps and Games] acadoid:
[MENTION=10271931]kasp6094[/MENTION]: Have a look on the `arrow´ examples. If you need a fixed length and/or a fixed orientation, calculate the second point instead of getting it from LN.getX2() and LN.getY2() and use LN.setClip() to set the clip rectangle accordingly.
[Android Apps and Games] kasp6094:
How would the code look if the arrow in theory had a distance of 10 and angle on 45 degrees?

Thanks for your work! ?
[Android Apps and Games] acadoid:
[MENTION=10271931]kasp6094[/MENTION]: Something like

x2 = x1 + 10 * Math.cos(0.78539);
y2 = y1 + 10 * Math.sin(0.78539);
[Android Apps and Games] caffeinatedinsanity:
This is what I've been looking for! I'm trying to figure out how to have circuit elements(like resistors, capacitors, Inductors, and voltage sources) as drawing tools. I don't currently know JavaScript so I stumbled across this while looking for code someone else might have made. I'm know thinking I'll just need to learn JavaScript and make my own. I know python and C++ so I hope it won't be too difficult to learn.
[Android Apps and Games] caffeinatedinsanity:
Problem with Transistor

This is amazing thank you so much. All the other ones worked perfectly but Transistor gives me an error saying that "evaluation of custom paper pattern takes too long" and it fails.
[Android Apps and Games] acadoid:
[MENTION=11003651]caffeinatedinsanity[/MENTION]: This error message appears when the JavaScript code takes more than 400ms to execute or contains an error. The code for the transistor seems to contain a few typos.
[Android Apps and Games] caffeinatedinsanity:
Modified for no parameters.

I love these thank you. I changed the code for the resistor, diode, capacitor, GND, and inductor to make it horizontal or vertical based on if the rectangle the user makes is more horizontal or more vertical. I used the code for a similar line from user herph.

https://drive.google.com/drive/folders/1CbbMc4pNdQpshWPBHmNl6DKIyl_Qn-yr?usp=sharing
[Android Apps and Games] caffeinatedinsanity:
I'm trying to come up with a way to make checkboxes that continue as you drag the drawling tool down. preferably snapping to every or every other grid, but would be happy even with the boxes being a set distance apart.
[Android Apps and Games] caffeinatedinsanity:
Quick Tool Toggle function

[MENTION=4619147]acadoid[/MENTION] Would it be possible to make a function that can be put into custom drawing tools to give use access to the double-click input. this would require that the user have the "double-click on custom drawing tools to open the tool settings" off, but then we could use the double-click input for something in our code. I want to use it to toggle the "one-time drawing tool" on a double click but I bet a lot of custom toolmakers would love to have access to a double-click input.
[Android Apps and Games] acadoid:
[MENTION=11003651]caffeinatedinsanity[/MENTION]: Your suggestion also requires that the `one-time drawing tool´ property can be changed by JavaScript code.
[Android Apps and Games] caffeinatedinsanity:
Yes sorry.

ya, it would. It's not something necessary just the thought came to me and It seemed like a cool idea. I'm not knowledgeable enough about the intricacies of building an app to know how difficult it would but wanted to share the idea that I thought would be cool.
[Android Apps and Games] d1as:
hi @acadoid

Is it possible to add "Containers" for pencils in the toolbox like there is for custom drawing tools?

I would like to group a bunch of premade colors and width in a container so it would only take 1 "square" in the pencil toolbox which will allow me to have more pencils for specific uses without having too big of a pencil toolbox.

Thx for the app, I truly think its the best app in the play store.
[Android Apps and Games] acadoid:
@d1as: I am glad to hear that you like the app.

There are ‘palettes’ of custom pencils, which are essentially like ‘containers’. One could allow to change palettes via the pencil toolbox.
[Android Apps and Games] d1as:
Is it possible to switch between palettes from within the pencil toolbox? I cannot find the option for it, and entering custom pencil settings to change it during a lecture is not what I had in mind, since I looked for a seamless transition, as with the containers I can choose to enter a group of custom drawing tools from within the toolbox which is very efficient and intuitive.
[Android Apps and Games] laolang_cool:
Is there any way to draw a trapezoid? I cant find any request for it, maybe I miss something?
[Android Apps and Games] acadoid:
@dlas: You cannot change palettes in the pencil toolbox, but that is an interesting idea.

@laolang_cool: Custom drawing tools have two input points, the start and the end of the selection. A general trapezoid requires more information, but you could use the two input points for a special trapezoid, for instance by fixing the length ratio of the two parallel sides.
[Android Apps and Games] odlodl:
Hi,

Thank you all for sharing your codes. It helps me a lot.

I want to add an integral sign.

I added a picture from Mathemtica for example.

I'm sure it can be prettier, but it is good enough for my needs.

Any help will be great :)

thanks.
[Android Apps and Games] acadoid:
@odlodl: UTF-8 contains an integral sign, U+222B, or ‘∫’.
[Android Apps and Games] odlodl:
Thanks!
[Android Apps and Games] caffeinatedinsanity:
Does anyone have an easy way to figure out which values I should use to draw an arc between 2 points?

Because figuring out the radius,radians, and center point has pretty much been a guess and check thing for me. I wish there was just a "LN.drawArc" command that took 2 points and a radius, but if I'm having trouble figuring it out then its probably not an easy command to create either.
[Android Apps and Games] MJannek:
Hi,what are the settings for the Trees?
[Android Apps and Games] Canguy247:
Question

[MENTION=4619147]acadoid[/MENTION]: I noticed that the pattern drawing functions are not available in custom tools. I would like to make some tools which draw paper patterns to allow different backgrounds on each page. I can add code which replaces these functions but it would be way easier if they worked.
[Android Apps and Games] acadoid:
[MENTION=4325794]JamMasterClay[/MENTION]: To let the custom drawing tool draw its own icon would be an option.

[MENTION=4226212]Tintinnuntius[/MENTION]: You are right, I did not notice that, many thanks for pointing this out to me; will be fixed with the next update.

[MENTION=5144453]Canguy247[/MENTION]: The next update will provide variants of the standard pattern drawing commands that also work for custom drawing tools. I also added custom drawing tool examples that use these commands.
[Android Apps and Games] Tintinnuntius:
Is there a way to set a font family inside a script? I would need a fixed width font for a script that writes out a 2x10 table full of decimal numbers ranging from 0.001 to 100 :angel:
[Android Apps and Games] acadoid:
[MENTION=4226212]Tintinnuntius[/MENTION]: No, but this is an interesting idea, I noted it down. Android does not provide much fonts, there is a sans-serif, a serif, and a monospace variant, with normal, italic, bold, and bold-italic.
[Android Apps and Games] Canguy247:
Awesome! Thanks!
[Android Apps and Games] Tintinnuntius:
[MENTION=4619147]acadoid[/MENTION] Will there be a way to easily batch-export scripts? I've written several probability&statistics related scripts that I would gladly share if anyone's interested, but I don't want to copy&paste each of them separately (especially since I keep tweaking them to make them better, so a quick way to get updated versions out would be great). If they could all be exported automatically it would be easy to make one zip file with all of them and post it here or share with colleagues.

Also, I like the build-in code editor a lot, the Run option is great for testing, and a bluetooth keyboard makes it easy to work with. Any chance we could also get some sort of syntax highlighting? Trying to find the one mistyped : between all the ; is annoying :(

Anyway, I've improved the discrete distributions scripts a bit by scaling them so they now use the vertical space more efficiently and I've moved the numbers around a bit. I've also made a few new ones. Now I have:

1. Discrete probability distributions: Uniform, Geometric, Binomial, Negative binomial, Poisson, Hypergeometric.

2. Data visualization: Pie chart, Bar chart (written by Canguy247; I added the same type of monochrome coloring as for pie charts), Sample statistics (take data, find average and sample standard deviation and plot it)

3. Continuous distributions: Normal, Chi squared (graphs of PDFs)

4. Tables: Student (also with z values), Chi squared (draws a single line for df < 30, the remainder of the table for df > 30)

The attached pdf showcases all of them. Let me know if you're interested in any of them and I can upload the code. Just please don't say "all of them" until we have an easy way to export them :)
[Android Apps and Games] acadoid:
[MENTION=4226212]Tintinnuntius[/MENTION]: I plan to add the possibility to combine drawing tools to containers/groups/libraries (I am not yet sure about the name) and share them in form of a ZIP file.

Well, syntax highlight is certainly feasible but not trivial, let me think about that.

In the meanwhile, please fell invited to post the JavaScript codes here which you think are the most useful to others.
[Android Apps and Games] Canguy247:
Menu suggestion

Hey,

I have done a quick and may mockup of how the tool menu could work. Please let me know what you think.

Also, is there any way to save the current page to either pdf or image file locally?
[Android Apps and Games] acadoid:
[MENTION=5144453]Canguy247[/MENTION]: You can share the current page, as PNG and PDF, using the items in the share menu.
[Android Apps and Games] acadoid:
[MENTION=4226212]Tintinnuntius[/MENTION]: I just uploaded v2.4.2 into the app stores. Among other things, there are now commands to set the font family and style.
[Android Apps and Games] Canguy247:
Graph paper

Here is some graph paper for the lab rats. Based on code from examples.

Added a header

width = LN.getWidth();
scale = LN.getScale();
step = width / 150 + scale * width / 25;
strokewidth = LN.getStrokeWidth();
x1 = LN.getX1();
y1 = LN.getY1();
x2 = LN.getX2();
y2 = LN.getY2();
x1g = (step / 2) + Math.floor((x1 - (step / 2)) / step + 0.5) * step;
y1g = (step / 2) + Math.floor((y1 - (step / 2)) / step + 0.5) * step;
x2g = (step / 2) + Math.floor((x2 - (step / 2)) / step + 0.5) * step;
y2g = (step / 2) + Math.floor((y2 - (step / 2)) / step + 0.5) * step;
fineStep=step/5;
xmin = Math.min(x1g, x2g);
ymin = Math.min(y1g, y2g);
xmax = Math.max(x1g, x2g);
ymax = Math.max(y1g, y2g);
LN.setClip(xmin, ymin-step, xmax, ymax);
LN.setSoftness(0);
LN.setStrokeWidth(0.5);
LN.setColor(0, 1, 0);
LN.setAlpha(0.3);
for(i=xmin;i <= xmax;i+=fineStep) {
LN.drawLine(i, ymin, i, ymax);
}
for(i=ymin;i <= ymax;i+=fineStep) {
LN.drawLine(xmin, i, xmax, i);
}
LN.setAlpha(1);
for(i=xmin;i <= xmax;i+=step) {
LN.drawLine(i, ymin, i, ymax);
}
for(i=ymin;i <= ymax;i+=step) {
LN.drawLine(xmin, i, xmax, i);
}
LN.setSoftness(0);
LN.setColor(0, 0, 0);
LN.setTextSize (step/3);
LN.setStrokeWidth(1.5);
LN.drawRect(xmin, ymin, xmax, ymax);
LN.drawRect(xmin, ymin, xmax, ymin-step);
LN.drawLine(xmax-(step*3), ymin, xmax -(step*3) , ymin-step);
LN.drawText ("Title", xmin+2, ymin-2);
LN.drawText ("#", xmax-(step*3)+ 2, ymin-2);
[Android Apps and Games] Canguy247:
Engineering grid

This is a grid which can be drawn anywhere, much like the graph paper above. The difference is that this is for engineering drawings.

width = LN.getWidth();
scale = LN.getScale();
step = width / 150 + scale * width / 25;
strokewidth = LN.getStrokeWidth();
x1 = LN.getX1();
y1 = LN.getY1();
x2 = LN.getX2();
y2 = LN.getY2();
x1g = (step / 2) + Math.floor((x1 - (step / 2)) / step + 0.5) * step;
y1g = (step / 2) + Math.floor((y1 - (step / 2)) / step + 0.5) * step;
x2g = (step / 2) + Math.floor((x2 - (step / 2)) / step + 0.5) * step;
y2g = (step / 2) + Math.floor((y2 - (step / 2)) / step + 0.5) * step;
xmin = Math.min(x1g, x2g);
ymin = Math.min(y1g, y2g);
xmax = Math.max(x1g, x2g);
ymax = Math.max(y1g, y2g);
gridWidth=(xmax-xmin)/step;
LN.setClip(xmin, ymin -(step*2) , xmax, ymax);
LN.setSoftness(0);
LN.setStrokeWidth(0.5);
LN.setColor (0, 0, 0.7);
LN.drawCheckeredPattern(scale, xmin - strokewidth / 2, ymin - strokewidth / 2, xmax + strokewidth / 2, ymax + strokewidth / 2);
LN.setColor (1, 0, 0);
LN.setStrokeWidth(1);
LN.drawRect(xmin, ymin, xmax, ymax);
LN.setTextSize(step/2);
if (gridWidth> 12){
LN.drawRect(xmin, ymin, xmax, ymin-(step*2));
LN.drawLine(xmin, ymin - step, xmax, ymin-step);
LN.drawLine (xmin+(gridWidth-3)*step, ymin-(step*2), xmin+(gridWidth-3)*step , ymin-step );
LN.setColor (0, 0, 0);
LN.drawText ("Number", xmin+(gridWidth-3)*step+2 , ymin-step-2);
LN.drawText ("Title", xmin+2 , ymin-step-2);
LN.drawText ("Notes", xmin+2 , ymin-2);
}
[Android Apps and Games] Canguy247:
Suggestion

[MENTION=4619147]acadoid[/MENTION]

I have to say that the custom drawing tools have the potential to really make LectureNotes an even more incredible app. I just have a suggestion which is based on my mockup from a few posts back.

This app is geared towards students. The custom drawing tools are amazing, but it is difficult to deal with the shear number of tools people would want in a way that it is easy for them to use. I have an idea which could help.

The user could organize their tools into pages of tools. They could switch between these pages using arrows, like in my mockup. This way they could have a separate page- or pages- for each class. Geometry would include shapes, electrical would include schematic symbols, etc.

Any thoughts?
[Android Apps and Games] acadoid:
[MENTION=5144453]Canguy247[/MENTION]: I plan to add ‘containers’ for custom drawing tools, both to ease selection as well as sharing with others.
[Android Apps and Games] Canguy247:
Circle slash

A little circle with a slash through it. Once again, I based it on some included code.

x1 = LN.getX1();
y1 = LN.getY1();
x2 = LN.getX2();
y2 = LN.getY2();
r = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
LN.setStrokeWidth (r/10);
xmin = x1 - r;
ymin = y1 - r;
xmax = x1 + r;
ymax = y1 + r;
xy=r/(2*Math.sqrt (2));
x=(x1+x2)/2;
y=(y1+y2)/2;
LN.setClip(xmin, ymin, xmax, ymax);
LN.drawOval(x, y, r/2, r/2);
LN.drawLine(x+xy, y-xy, x-xy, y+xy);
[Android Apps and Games] MarlinFF:
This script is AMAZING for organic chemistry where I have to constantly draw benzenes now. Thank you!
[Android Apps and Games] Tintinnuntius:
[MENTION=3121787]MarlinFF[/MENTION] I'm glad you find it useful.

[MENTION=4619147]acadoid[/MENTION] Thank you for adding icons and containers for custom tools. I'm amazed at how easy importing icons from clipboard is. Also, I think I found a few bugs:

- After I switched to "smaller 50%" toolbox size, I'm unable to switch back to "smaller 75%". I can switch to other sizes, though, it's just 75% that's not working.

- When using the 50% size, custom drawing tools are displayed correctly, but I think the standard ones suffer from the fat font effect.

Finally, when pasting the icon from clipboard, the selection seems to be aligned top and left. I've been compensating manually to ensure that the final icon is centered properly, but it would be great if the selection could be centered automatically in both vertical and horizontal direction. That is, this would be best for me personally, maybe other people would prefer top left alignment. Also, importing icons is not something done on a regular basis for most people, so it's not really that important.

And thanks again, this app is amazing.
[Android Apps and Games] acadoid:
[MENTION=4226212]Tintinnuntius[/MENTION]: Glad to hear that you like the custom drawing tool container.

Many thanks for pointing this problem out to me. I already uploaded a new APK into the app stores (since the change is very minor, it carries the same version number v2.4.6).

Images pasted from clipboard (as well as imported images) are scaled horizontally and/or vertically so that all four corners match; in this sense, the image is always centered.