# C/C++

## Numerical Methods Multiplication of two matrices using two dimensional array in CC

Numerical Methods: Multiplication of two matrices using two dimensional array in C/C++ Source Code   #include int main() { int r1, c1, r2, c2, matrix1[10][10], matrix2[10][10], result[10][10]; int i, j, k; printf(“Enter the row and column of the first matrix: “); scanf(“%d%d”,&r1,&c1); printf(“Enter the row and column of the second …

## Lab assignments and problems on Data Structure with CC code and Algorithm

Lab assignments and problems on Data Structure with C/C++ code and Algorithm Here are lists of lab assignments and problems on various topics in Data Structure. Please click the link below to see the algorithm and source code of the problem in that topic. Stack Queue Circular Queue Infix to …

## 3D Rotation Algorithm about arbitrary axis with CC code

3D Rotation Algorithm about arbitrary axis with C/C++ code When an object is to be rotated about an axis that is not parallel to one of the coordinate axes, we need to perform some additional transformations. In this case, we also need rotations to align the axis with a selected …

## CohenSutherland Line Clipping Algorithm with CC

Cohen-Sutherland Line Clipping Algorithm with C/C++ Theory In this method, every line endpoint is assigned a four digit binary code(region code) that identifies the location of the point relative to the boundary. b1 : left  b2 : right  b3 : below  b4 : above The value 1 indicates its relative …

## LiangBarsky Line Clipping Algorithm with CC

Liang-Barsky Line Clipping Algorithm with C/C++ TheoryIn Liang-Barsky algorithm, we first write the point-clipping conditions in parametric form as  Each of these for inequalities can be expressed as , k = 1, 2, 3, …..where parameter p and q are defined as Any line that is parallel to one of …

## 3D Transformation Translation Rotation and Scaling in CC

3D Transformation [Translation, Rotation and Scaling] in C/C++ Translation In a three-dimensional homogeneous coordinates representation, a point is translated from position P = (x, y, z) to position P’ = (x’, y’, z’) with the following equations. x’ = x + tx y’ = y + ty z’ = z …

## Computer Graphics Fractals generation using Mandelbrot Set with CC in CodeBlocks

Computer Graphics: Fractals generation using Mandelbrot Set with C/C++ in Code::Blocks “Clouds are not spheres, mountains are not cones, coastlines are not circles, and bark is not smooth, nor does lightning travel in a straight line.” – Benoit Mandelbrot The Mandelbrot set is created by a general technique where a …

## Bezier Curves and Bezier Surfaces generation with CC in CodeBlocks

Bezier Curves and Bezier Surfaces generation with C/C++ in Code::Blocks Brief Theory of Bezier Curve In order to draw curvy surface we implement Bezier curve algorithm. In drawing Bezier we first define n+1 control point pk = (xk, yk, zk) with k varying from 0 to n. And the coordinate …

## Transformation Translation Rotation and Scaling of a two dimensional objects in CC

Transformation (Translation, Rotation and Scaling) of a two dimensional objects in C/C++ 1. Translation A translation is applied to an object by repositioning it along a straight-line path from one coordinate location to another. We translate a two-dimensional point by adding translation distances, tx and ty, to the original coordinate …

## Random number generation in CC

Random number generation in C/C++ Many programs need random number to complete their certain goal. For example, a quiz program needs random number to randomize the question number to be asked first. Likewise a dice game needs random number to select the face when it is thrown. So there are …

## Drawing an Ellipse with Mid Point Ellipse Algorithm in CC

Drawing an Ellipse with Mid Point Ellipse Algorithm in C/C++ The theory for drawing Ellipse with Mid Point Algorithm is same as that of Circle drawing. But the difference is that the Ellipse is divided into two regions because it has two radii. The regions are separated from each other …

## Drawing a Circle with Mid Point Circle Algorithm in CC

Drawing a Circle with Mid – Point Circle Algorithm in C/C++ As in the previous line drawing algorithm, we sample at unit intervals and determine the closest pixel position to the specified circle path at each step. For a given radius r and screen center position (xc, yc), we can …

## Numerical Method Newtons Forward and Backward Interpolation in CC

Numerical Method: Newton’s Forward and Backward Interpolation in C/C++ #include #include int main() { float x[10],y[15][15]; int n,i,j; printf(“Enter n : “); scanf(“%d”,&n); printf(“X\tY\n”); for(i = 0;i

## Implementing Bresenhams Line Drawing Algorithm in CC

Implementing Bresenham’s Line Drawing Algorithm in C/C++ Bresenham’s Line Drawing Algorithm is an accurate and efficient raster line-generating algorithm developed by Bresenham. In this algorithm, we first consider the scan – conversion process for lines with positive slope less than 1. Pixel positions along a line path are then determined …