Who can help me to learn programming c++?

it’s usually for the sake of other programmers. if you work with other coders, then using “i” might get a little annoying for them.

putting some care into an object’s name is a good way to make a code easily understandable. it even helps me when I write code. but then again, I’m easily confused so it might be more helpful for coders like me… lol lol lol lol

1 Like

I might take a Java course this summer at my school

3 Likes

what makes code easier to read is which language it’s written in not the style it’s written in

1 Like

but when the language is the same, then putting care in your object’s name can really help other coders understand your implementations that use the object, right?

2 Likes

what really helps understand the implementations is knowing the class

using descriptive names is a good thing but sometimes a variable is in a really small scope and isn’t used much and has such a short life that it doesn’t matter

but what I’m saying is these coding style rules aren’t something to spend any time memorizing and obsessing over. coding style just comes naturally after experience

2 Likes

yeah, I agree that everyone has his own style. to each, his own.

my style is to name objects and classes in a way which will make it easy for other coders to understand, including myself when I review old implementations (which happens frequently.)

but yes: to each, his own.

by the way, I haven’t really worked with other coders. it would be cool to work on a programming project with a coder though. if only I was in college.

have you ever worked alongside other coders? probably a rude question, seeing that you seem experienced.

1 Like

I suspect that on a 64 bit processor, your 32 bit float takes up a whole register variable just like a 64 bit double. Honestly, the only time you really see float values are in spots where imposing a limit on precision is conceptually sound. A font size cannot be anymore meaningfully represented with 64 bits than 32. A Graphics context uses SizeF and PointF for the reason that a double precision floating point value has no meaning when rendering to, say, a printer.

Incidentally, you should always use integers with 3d models and colors because integer arithmetic . . . google Bresenham’s Algorithm.

A lot of people use i, j, and k. I use ctr1, ctr2, and ctr3 because of the first C programming book I bought.

Oh, can I ask you something? I understand about rotations and translations and scaling, and I can copy the code out of a book just fine, but I never really understood how to take your (x,y,z) world coordinate and translate it into a screen coordinate. I assume it has to do with vector projection, but I’m not sure.

Another thing, i was working with quasi-triadic colors a few months ago and I had the idea of projecting the (r,g,b) value of my initial color value onto the z unit vector then creating vectors along the x and y axes, the tips of which formed an isosceles triangle with the tip of the vector projected onto the z unit vector with a given top angle, theta.

This was easy enough, but for the life of me, I couldn’t figure out how to project the other two vectors along the x and y axes back into regular 3-space to retrieve their rgb values. I ask because it seems related to the other problem.

This ain’t no big deal but I can do a simple hello,world program in qbasic

Cls
Print "hello world"
Cls
Print "I apologize if u think I did something offensive… it was purely unintentional"
Cls

1 Like

QBasic music composers are rare

Most of what people do when they are hacking is running scripts that someone else wrote they are known as script kiddies

Have u tried meetup.com? U can search for meetings of people with similiar interests I would have made use of it more but I can’t drive myself to and fro.

I’m unable to understand what you are trying to describe with the vector system for the quasi-triadic colors.

You’re going to have to pick some way to blend the colors. I would use a weighted blend based off the distance away from each of the three points. The closer to the point the closer to 100%. You could use the 2d distance formula. So basically blend them together with a weighted average.

On converting into screen coordinates. It is really complicated but it works through matrix operations. I don’t fully understand how all matrices work especially the projection matrix. How it works is I have these different matrices projection, rotation, and translation. They have to be in reverse order because reasons. (they call it row/column major) They are combined into what is called the “mvp” matrix. This mvp matrix is multiplied by 3d locations and magically the results are screen coordinates. Google “graphics mvp matrix” for better information.

And I’ve still found floats to be about 6% faster than doubles on my 64 bit computer after running some tests.

And if precision does matter as in equality I don’t use doubles or floats. I use integers.

1 Like

I just saw this graphic is what you’re trying to do is pick every fourth color?
http://www.brandigirlblog.com/wp-content/uploads/2012/11/triad-example.png
This color wheel has 12 elements. Assuming you have the colors in an array it should be a simple matter take whichever color is selected and add 4 and 8 to it to get the other two colors.

Of course you will have to check for the “loop around”. If the user picks color#11 and the matching colors are #15 and #19. You will have to subtract 12 from the other colors if they are out of bounds.

if(12 <= color2)color2 -= 12;
if(12 <= color3)color3 -= 12;

1 Like

No, what I was looking for was to be able to change the angle at the top to modify the position of the other two points. And I needed the answer in rgb values, eight bits per channel. Couldn’t figure it out.

1 Like

I’m a novice, but changing the angle seems overly complicated.

eeee’s approach seems reasonably simplier.

you can set an array of RGB values. the array can be as big as you want, for finer details in color.

once you set the array, you can increment just like eeee suggested. the increment will depend on the size of the array and the angle you want, but all of those calculations are a lot simpler than adjusting an angle and turning things into an intense trigonometry problem.

Wow… this is a neat topic!

Glad to see so many people putting it out there so generously point to point.

If I had anything to add it is something I just recently finalized for myself in regards to the nature of greater variable structures. Spelling it out is going to help me really secure my thinking on it and give you guys a chance to tell me if I’m wrong.

So you have the basic variable types as mentioned above:

bool (binary toggle)

Int (whole number no decimal)
Float (number with order of magnitude stored)
Double Float (Float with added bits for more refined numbered)

Char (ASCII code that the program knows to reference for corresponding letter)
String (Array of variable type Char with a bunch of sub functions for easy use) "#include " to use

Those are the basics… but I want to detail Unions, Structs, and Classes.

I think unions are neat because it holds the data in the same place but a union can be called to act as divergent variable types… so for example 1010 can be read as 18… but also a char, setting the letter A at 0001 would make 1010 == “R” instead. Instead of mandating that and int always be an int… you can break the rules if you want.

Structs are cool cause the just solid and not complicated.

struct dataset(){
int a;
double b;
}

can refer to dataset.a as an integer in code… and dataset.b as a double… while only using one line to declare a new instance. Really cool for pairing up things that will always be needed together.

Class itself looks really complicated at first and I still don’t like the nomenclature regarding the word “class” itself… it’s an abstract use of the word if interpreted litterally… “Classification” is what they had to mean in the sense: This is what it is (the variable space) and this is what you can do with it (the function space).

Classes are cool… they can be used to just about anything and keep program flow neat and intense coding blocks that prone to have complicated errors all separated out into libraries where they can compiled separately and then built and compile when the whole shebang is good to go.

Public and Private… those are key words in understanding classes. Data types can be used just like with Struct so long as they are public. Publicly accessible variables from out side the class. Privates are constrained to only being manipulable by functions defined within the class.

Bah I don’t think text alone really conveys a good way to see all that.

This is the site I use,… good old http://www.cplusplus.com/doc/tutorial/

1 Like

https://www.mathsisfun.com/sine-cosine-tangent.html

First thing you need to do is find your starting angle. To base the other two angles off of.

double angle1 = atan(x1/y1);
if(y1 < 0)angle1 += 180;
double angle2 = angle1 + 120;
double angle3 = angle2 + 120;

Now you can use the angles to find the other two points.

double distance = Math.sqrt(x1 * x1 + y1 * y1);
double x2 = sin(Math.toRadians(angle2)) * distance;
double y2 = cos(Math.toRadians(angle2)) * distance;
double x3 = sin(Math.toRadians(angle3)) * distance;
double y3 = cos(Math.toRadians(angle3)) * distance;

The distance/starting vertex might need to be normalized for what you are doing.

I will never be programmer i am too lazy

1 Like

tutor/professor/class could be good motivator. if I had money, I’d be learning programming faster.

using math functions requires cmath `or the use of an additional file. really don’t see the need to go trigonometric.

If the prior implementations revolved around trigonometry, then the implementer will have a greater reason to use trigonometry. In that case, continuing to use trigonometry would be more faster than starting a new design from scratch

but even trigonometric values produce approximations. approximations aren’t always good to deal with. has the programmer tried not using trigonometry? math always seems like a last resort, because math presents a lot of cases and situations that a program can’t really handle. and math is just overall messier to deal with.