Wednesday, December 9, 2020

Write a programme of Cohen Sutherland Line clipping Algorithm in C.

 Cohen Sutherland Line clipping Algorithm

#include<stdio.h>

#include<stdlib.h>

#include<math.h>

#include<graphics.h>

#include<dos.h>

#include<conio.h>

typedef struct coordinate

{

    int x,y;

    char code[4];

}PT;

void drawwindow();

void drawline(PT p1,PT p2);

PT setcode(PT p);

int visibility(PT p1,PT p2);

PT resetendpt(PT p1,PT p2);

void main()

{

    int gd=DETECT,v,gm;

    PT p1,p2,p3,p4,ptemp;

   printf("\n\tEnter x1 and y1\n");

    scanf("%d %d",&p1.x,&p1.y);

    printf("\n\tEnter x2 and y2\n");

    scanf("%d %d",&p2.x,&p2.y);

   initgraph(&gd,&gm,"c:\\turboc3\\bgi");

    drawwindow();

    delay(500);

  drawline(p1,p2);

    delay(500);

    cleardevice();

   delay(500);

    p1=setcode(p1);

    p2=setcode(p2);

    v=visibility(p1,p2);

    delay(500);

   switch(v)

    {

    case 0: drawwindow();

                delay(500);

                drawline(p1,p2);

                break;

    case 1:    drawwindow();

                delay(500);

                break;

    case 2:    p3=resetendpt(p1,p2);

                p4=resetendpt(p2,p1);

                drawwindow();

                delay(500);

                drawline(p3,p4);

                break;

    }

   delay(5000);

    closegraph();

    getch();

}

void drawwindow()

{

    line(150,100,450,100);

    line(450,100,450,350);

    line(450,350,150,350);

    line(150,350,150,100);

}

void drawline(PT p1,PT p2)

{

    line(p1.x,p1.y,p2.x,p2.y);

}

PT setcode(PT p)    //for setting the 4 bit code

{

    PT ptemp;

 

    if(p.y<100)

            ptemp.code[0]='1';    //Top

    else

            ptemp.code[0]='0';

 

    if(p.y>350)

            ptemp.code[1]='1';    //Bottom

    else

            ptemp.code[1]='0';

 

    if(p.x>450)

            ptemp.code[2]='1';    //Right

    else

            ptemp.code[2]='0';

 

    if(p.x<150)

            ptemp.code[3]='1';    //Left

    else

            ptemp.code[3]='0';

 

    ptemp.x=p.x;

    ptemp.y=p.y;

   return(ptemp);

}

int visibility(PT p1,PT p2)

{

    int i,flag=0;

 

    for(i=0;i<4;i++)

    {

            if((p1.code[i]!='0') || (p2.code[i]!='0'))

                flag=1;

    }

  if(flag==0)

            return(0);

 

    for(i=0;i<4;i++)

    {

            if((p1.code[i]==p2.code[i]) && (p1.code[i]=='1'))

                flag='0';

    }

 

    if(flag==0)

            return(1);

 

    return(2);

}

 

PT resetendpt(PT p1,PT p2)

{

    PT temp;

    int x,y,i;

    float m,k;

  if(p1.code[3]=='1')

            x=150;

  if(p1.code[2]=='1')

            x=450;

    if((p1.code[3]=='1') || (p1.code[2]=='1'))

    {

            m=(float)(p2.y-p1.y)/(p2.x-p1.x);

            k=(p1.y+(m*(x-p1.x)));

            temp.y=k;

            temp.x=x;

           for(i=0;i<4;i++)

                temp.code[i]=p1.code[i];

     if(temp.y<=350 && temp.y>=100)

                return (temp);

    }

 if(p1.code[0]=='1')

            y=100;

   if(p1.code[1]=='1')

            y=350;

   if((p1.code[0]=='1') || (p1.code[1]=='1'))

    {

            m=(float)(p2.y-p1.y)/(p2.x-p1.x);

            k=(float)p1.x+(float)(y-p1.y)/m;

            temp.x=k;

            temp.y=y;

           for(i=0;i<4;i++)

                temp.code[i]=p1.code[i];

        return(temp);

    }

    else

            return(p1);

}

 

 Output :- 




Write a programme of Boundary Fill Algorithm in C.

 Boundary Fill Algorithm

#include<stdio.h>

#include<graphics.h>

#include<dos.h>

#include<conio.h>

void boundaryfill(int x,int y,int f_color,int b_color)

{

    if(getpixel(x,y)!=b_color && getpixel(x,y)!=f_color)

    {

        putpixel(x,y,f_color);

        boundaryfill(x+1,y,f_color,b_color);

        boundaryfill(x,y+1,f_color,b_color);

        boundaryfill(x-1,y,f_color,b_color);

        boundaryfill(x,y-1,f_color,b_color);

    }

}

//getpixel(x,y) gives the color of specified pixel

int main()

{

    int gm,gd=DETECT,radius;

    int x,y;

    printf("Enter x and y positions for circle\n");

    scanf("%d%d",&x,&y);

    printf("Enter radius of circle\n");

    scanf("%d",&radius);

    initgraph(&gd,&gm,"c:\\turboc3\\bgi");

    circle(x,y,radius);

    boundaryfill(x,y,4,15);

    delay(5000);

    closegraph();

    getch();

    return 0;

}

output- 



Write a programme of Flood Fill Algorithm in C.

 Flood Fill Algorithm

#include<stdio.h>

#include<graphics.h>

#include<dos.h>

#include<conio.h>

 void floodFill(int x,int y,int oldcolor,int newcolor)

{

    if(getpixel(x,y) == oldcolor)

    {

        putpixel(x,y,newcolor);

        floodFill(x+1,y,oldcolor,newcolor);

        floodFill(x,y+1,oldcolor,newcolor);

        floodFill(x-1,y,oldcolor,newcolor);

        floodFill(x,y-1,oldcolor,newcolor);

    }

}

//getpixel(x,y) gives the color of specified pixel

 int main()

{

clrscr();

    int gm,gd=DETECT,radius;

    int x,y;

    printf("Enter x and y positions for circle\n");

    scanf("%d%d",&x,&y);

    printf("Enter radius of circle\n");

    scanf("%d",&radius);

    initgraph(&gd,&gm,"c:\\turboc3\\bgi");

    circle(x,y,radius);

    floodFill(x,y,0,15);

    delay(5000);

    closegraph();

    return 0;

getch();

}

output- 



Thursday, November 26, 2020

Lists of Different 3D Software in PC

 3D Software 

1. Autodesk 3ds Max:-

Operating system: Windows 7 or later

Description: Autodesk 3ds Max, formerly 3D Studio, then 3D Studio Max is a professional 3D computer graphics program for making 3D animations, models, games, and images. It’s developed and produced by Autodesk Media and Entertainment. It has modeling capabilities and a flexible plugin architecture and can be used on the Microsoft Windows platform. It is frequently used by video game developers, many TV commercial studios, and architectural visualization studios. It is also used for movie effects and movie pre-visualization. For its modeling and animation tools, the latest version of 3ds Max also features shaders (such as ambient occlusion and subsurface scattering), dynamic simulation, particle systems, radiosity, normal map creation and rendering, global illumination, a customizable user interface, new icons, and its own scripting language.

 2. Cinema 4D:-

Operating system: AmigaOS, MacOS, Microsoft Windows

Description: CINEMA 4D is a 3D modeling, animation, motion graphic and rendering application developed by MAXON Computer GmbH in Germany. It is capable of procedural and polygonal/subd modeling, animating, lighting, texturing, rendering, and common features found in 3D modeling applications. Four variants are currently available from MAXON: a core CINEMA 4D 'Prime' application, a 'Broadcast' version with additional motion-graphics features, 'Visualize' which adds functions for architectural design and 'Studio', which includes all modules.

Initially, CINEMA 4D was developed for Amiga computers in the early 1990s, and the first three versions of the program were available exclusively for that platform. With v4, however, MAXON began to develop the program for Windows and Macintosh computers as well, citing the wish to reach a wider audience and the growing instability of the Amiga market following Commodore's bankruptcy.

 3. Houdini:-

Operating system: Windows, MacOS, Linux

Description: Houdini is a 3D animation application software developed by Side Effects Software based in Toronto. Side Effects adapted Houdini from the PRISMS suite of procedural generation software tools. Its exclusive attention to procedural generation distinguishes it from other 3D computer graphics software.

Houdini has been used in various feature animation productions, including Disney's feature films Frozen and Zootopia; the Blue Sky Studios film Rio, and DNA Productions' Ant Bully.

Side Effects also publishes a partially limited version called Houdini Apprentice, which is free of charge for non-commercial use.

4. Poser:-

Operating system: Windows, OS X

Description: Poser is a 3D computer graphics programoptimized for 3D modeling of human figures. The program has gained popularity due to allowing beginners to produce basic animations and digital images, and the extensive availability of third-party digital models. Poser is a 3D rendering software package for the posing, animating and rendering of 3D polymesh human and animal figures. Akin to a virtual photography studio, Poser allows the user to load figures, props, lighting, and cameras for still and animated renderings.

Natively using a subset of the Alias object (OBJ) file format and a text-based markup for content files, Poser comes with a large library of pre-rigged human, animal, robotic, and cartoon figures. The package also includes poses, hair pieces, props, textures, hand gestures, and facial expressions. As Poser itself does not allow for original modeling of objects, a large community market of artists emerged, creating and selling Poser content, made using third-party software like Modo, ZBrush, Blender or Autodesk 3ds Max.

 5. Autodesk Softimage:-

Operating system: Microsoft Windows, Linux

Description: Autodesk Softimage, or simply Softimage is a 3D computer graphics application, owned by Autodesk, for producing 3D computer graphics, 3D modeling, and computer animation. Formerly Softimage|XSI, the software was predominantly used in the film, video game, and advertising industries for creating computer generated characters, objects, and environments.

A free version of the software, called Softimage Mod Tool, was developed for the game modding community to create games using the Microsoft XNA toolset for PC and Xbox 360, or to create mods for games using Valve Corporation's Source engine, Epic Games' Unreal Engine and others. It was discontinued the release of Softimage 2014.

 6. iClone :-

Operating system: Windows

Description: iClone is a real-time 3D animation and rendering software program that enables users to make 3D animated films. Real-time playback is enabled by using a 3D video game engine for instant on-screen rendering.

Other functionality includes: full facial and skeletal animation of human and animal figures; lip-syncing; import of standard 3D file types including FBX; a timeline for editing and merging motions; a scripting language (Lua) for character interaction; application of standard motion-capture files; the ability to control an animated scene in the same manner as playing a video game; and the import of models from Google 3D Warehouse, among many other features. iClone is also notable for offering users royalty-free usage of all content that they create with the software, even when using Reallusion's own assets library.

7. Aladdin 4D:-

Operating system: AmigaOS, Mac OS X, iPad, Linux, AROS, MorphOS, Windows

Description: Aladdin4D is a computer program for modeling and rendering three-dimensional graphics and animations, currently running on AmigaOS and Mac OS X platforms. A-Eon Technology Ltd owns the rights and develops current and future versions of Aladdin4D for AmigaOS, MorphOS & AROS. All other platforms including OS X, iOS, Windows & Linux are developed by DiscreetFX. Nova Design added many modern features and made it easier to use. It was one of the first 3D animation programs on any platform to employ volumetrics, which were primarily used to create volumetric gas. However, unlike the majority of Amiga 3D programs, it used scanline rendering instead of the more photo-realistic ray tracing technique. Scanline rendering is similar to the rendering technique used in most Pixar movies. 

 8. Blender :- 

Operating system: Windows, Mac OS, Linux

Description: Blender is a professional, free and open-source 3D computer graphics software toolset used for creating animated films, visual effects, art, 3D printed models, interactive 3D applications and video games. Blender's features include 3D modeling, UV unwrapping, texturing, raster graphics editing, rigging and skinning, fluid and smoke simulation, particle simulation, soft body simulation, sculpting, animating, match moving, camera tracking, rendering, video editing and compositing. It further features an integrated game engine.

 9. LightWave 3D:-

Operating system: AmigaOS, Windows, MacOS

Description:  LightWave is a software package used for rendering 3D images, both animated and static. It includes a fast rendering engine that supports such advanced features as realistic reflection, radiosity, caustics, and 999 render nodes. The 3D modeling component supports both polygon modeling and subdivision surfaces. The animation component has features such as reverse and forward kinematics for character animation, particle systems, and dynamics. Programmers can expand LightWave's capabilities using an included SDK which offers Python, LScript (a proprietary scripting language) scripting and C language interfaces.

 10. Autodesk MotionBuilder:-

Operating system: Windows, Linux

Description: MotionBuilder is a professional 3D character animation software produced by Autodesk. It is used for virtual production, motion capture, and traditional keyframe animation. It was originally named Filmbox when it was first created by Canadian company Kaydara, later acquired by Alias and renamed to MotionBuilder. Alias, in turn, was acquired by Autodesk.

It is primarily used in film, games, television production, as well as other multimedia projects. Mainstream examples include Assassin's Creed, Killzone 2, and Avatar.

At SIGGRAPH 2012, Autodesk announced a partnership with Weta Digital and Lightstorm Entertainment to develop the next generation of the technology.


Lists of Different 2D Software use in PC

 2D Software

1.  Moho (Anime Studio):-

Operating system: Microsoft Windows, Mac OS X

Description: Moho is a proprietary vector-based 2D animation software for animators. The Moho software has two different versions: Anime Studio Debut and Anime Studio Pro. The first one doesn't have all the functions that the Pro version has, plus the Debut version is a bit more restricted in terms of possible length and image size. Anime Studio Pro no longer supports the Linux platform. Anime Studio is available in English, German and Japanese language (and Spanish since version 9.2).

2.  Synfig Studio:-

Operating system: Linux, Mac OS X, Windows

Description: Synfig Studio is an open source, free timeline-based, and 2D vector graphics computer animation program. Synfig is a real back-end and front-end application, that allows you to design your animation in front-end and render it in backend at a later time even on another computer, without having to connect the graphical display.

3.  Adobe Animate:-

Operating system: Windows, OS X

Description:  Adobe Animate is a computer animation and multimedia authoring program developed by Adobe Systems. If you need to create vector graphics and animation, Animate is the right tool for you. You can, later on, use your creation for websites, online videos, rich internet apps, video games and television programs. Adobe Animate offers support for video and audio embedding, ActionScript scripting, rich text and raster graphics.

4.  Pencil 2D:-

Operating system: Linux, OS X, Microsoft Windows

Description: Pencil2D is an open-source and free 2D animation software. You can easily produce simple 2D drawings, graphics, and animation by using the bitmap/vector drawing interface of the application. It started as a simple "pencil test" at first and developed into an animation software.

5.  Toonz:-

Operating system: Linux, macOS, Microsoft Windows

Description: Opentoonz is an open-source 2D animation software. Toonz Premium is the professional product of the same family. This software has been used to create many different films and games, such as Futurama, Anastasia, Asterix in America (in this movie the part of the sea storm was created by Toonz completely), and much more.

6. TupiTube

Operating system: Unix-like, Windows, Mac OS X

Description: TupiTube is an open-source application to create and share 2D animation content focused on children, teenagers, and amateurs. The main feature of this tool is the easy animation creation process, which includes only 5 simple steps.

7.  TVPaint Animation:-

Operating system:  Microsoft Windows, Mac OS X, Linux, Android, AmigaOS (from v1.0 to 3.59)

Description: TVPaint Animation is a 2D digital animation and paint software package, that has been developed by TVPaint Developpement SARL. The software supports most of the operating systems existing today. It has been used to create many animated and otherwise movies.

8.  DigiCel FlipBook:-

Operating system: Microsoft Windows, Mac OS X

Description: DigiCel FlipBook is a 2D animation software. It was created with the intention of duplicating the animation process in its traditional form, much like Toon Boom Harmony and TVPaint. As FlipBook wants to keep the traditional aspect and the traditional toolkit of the animation, it does not support skeletal animation. Thus each frame has to be created and drown separately and inbetweening is performed via onion skinning. The toolkit is raster-based and supports direct digital input of a drawing using graphics tablet and scanning the physical drawing via either webcam or TWAIN-compliant scanner.  

9.  DrawPlus:-

Operating system: Microsoft Windows

Description: DrawPlus is an animation and 2D vector graphics editing software. DrawPlus provides very realistic brushes, which can give the user the opportunity to create drawing with watercolors, oils and other media and you can retain the vector editing capability. DrawPlus is also able to produce Stop frame and Keyframe animations, including output to Adobe Flash SWF file format and support for ActionScript.

DrawPlus X8 (paid version) and Starter Edition (completely free) offer support for pressure-sensitive input devices such as Wacom's range of tablets. Both applications feature a Pressure Studio to allow calibration of the individual devices and allow functions to be mapped to the supported buttons on the tablet. DrawPlus supports pressure-sensitive vector lines and brushes to create a striking range of effects from manga through to painting in an array of media.

10.  Retas Studio:-

Operating system: Microsoft Windows, Mac OS

Description: RETAS (Revolutionary Engineering Total Animation System) is a 2D animation software bundle developed and sold by Celsys that is available for Microsoft Windows and Mac OS X. It handles the entire animation production from digitally drawing or tracing to exporting in Flash and QuickTime, and is considered to be a leader in Japan's anime industry.

discontinued in 1998. In 2006, a project to build a completely new Antics software for C++ and Windows was begun, and the first published version made available in 2010.