answersLogoWhite

0

Draw a car in c plus plus?

User Avatar

Anonymous

12y ago
Updated: 8/19/2019
$ROOTSYS/tutorials/graphs/motorcycle.C#include "TString.h" #include "TInterpreter.h" #include #include "TH1.h" #include "TGraphSmooth.h" #include "TCanvas.h" #include "TSystem.h" TCanvas *vC1; TGraph *grin, *grout; void DrawSmooth(Int_t pad, const char *title, const char *xt, const char *yt) { vC1->cd(pad); TH1F *vFrame = gPad->DrawFrame(0,-130,60,70); vFrame->SetTitle(title); vFrame->SetTitleSize(0.2); vFrame->SetXTitle(xt); vFrame->SetYTitle(yt); grin->Draw("P"); grout->DrawClone("LPX"); } void motorcycle() { /****************************************************************************** * Author: Christian Stratowa, Vienna, Austria. * * Created: 26 Aug 2001 Last modified: 29 Sep 2001 * ******************************************************************************/ // Macro to test scatterplot smoothers: ksmooth, lowess, supsmu // as described in: // Modern Applied Statistics with S-Plus, 3rd Edition // W.N. Venables and B.D. Ripley // Chapter 9: Smooth Regression, Figure 9.1 // // Example is a set of data on 133 observations of acceleration against time // for a simulated motorcycle accident, taken from Silverman (1985). // data taken from R library MASS: mcycle.txt TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName()); dir.ReplaceAll("motorcycle.C",""); dir.ReplaceAll("/./","/"); // read file and add to fit object Double_t *x = new Double_t[133]; Double_t *y = new Double_t[133]; Double_t vX, vY; Int_t vNData = 0; ifstream vInput; vInput.open(Form("%smotorcycle.dat",dir.Data())); while (1) { vInput >> vX >> vY; if (!vInput.good()) break; x[vNData] = vX; y[vNData] = vY; vNData++; }//while vInput.close(); grin = new TGraph(vNData,x,y); // draw graph vC1 = new TCanvas("vC1","Smooth Regression",200,10,900,700); vC1->Divide(2,3); // Kernel Smoother // create new kernel smoother and smooth data with bandwidth = 2.0 TGraphSmooth *gs = new TGraphSmooth("normal"); grout = gs->SmoothKern(grin,"normal",2.0); DrawSmooth(1,"Kernel Smoother: bandwidth = 2.0","times","accel"); // redraw ksmooth with bandwidth = 5.0 grout = gs->SmoothKern(grin,"normal",5.0); DrawSmooth(2,"Kernel Smoother: bandwidth = 5.0","",""); // Lowess Smoother // create new lowess smoother and smooth data with fraction f = 2/3 grout = gs->SmoothLowess(grin,"",0.67); DrawSmooth(3,"Lowess: f = 2/3","",""); // redraw lowess with fraction f = 0.2 grout = gs->SmoothLowess(grin,"",0.2); DrawSmooth(4,"Lowess: f = 0.2","",""); // Super Smoother // create new super smoother and smooth data with default bass = 0 and span = 0 grout = gs->SmoothSuper(grin,"",0,0); DrawSmooth(5,"Super Smoother: bass = 0","",""); // redraw supsmu with bass = 3 (smoother curve) grout = gs->SmoothSuper(grin,"",3); DrawSmooth(6,"Super Smoother: bass = 3","",""); // cleanup delete [] x; delete [] y; delete gs; }

motorcycle.C:1

motorcycle.C:2

motorcycle.C:3

motorcycle.C:4

motorcycle.C:5

motorcycle.C:6

motorcycle.C:7

motorcycle.C:8

motorcycle.C:9

motorcycle.C:10

motorcycle.C:11

motorcycle.C:12

motorcycle.C:13

motorcycle.C:14

motorcycle.C:15

motorcycle.C:16

motorcycle.C:17

motorcycle.C:18

motorcycle.C:19

motorcycle.C:20

motorcycle.C:21

motorcycle.C:22

motorcycle.C:23

motorcycle.C:24

motorcycle.C:25

motorcycle.C:26

motorcycle.C:27

motorcycle.C:28

motorcycle.C:29

motorcycle.C:30

motorcycle.C:31

motorcycle.C:32

motorcycle.C:33

motorcycle.C:34

motorcycle.C:35

motorcycle.C:36

motorcycle.C:37

motorcycle.C:38

motorcycle.C:39

motorcycle.C:40

motorcycle.C:41

motorcycle.C:42

motorcycle.C:43

motorcycle.C:44

motorcycle.C:45

motorcycle.C:46

motorcycle.C:47

motorcycle.C:48

motorcycle.C:49

motorcycle.C:50

motorcycle.C:51

motorcycle.C:52

motorcycle.C:53

motorcycle.C:54

motorcycle.C:55

motorcycle.C:56

motorcycle.C:57

motorcycle.C:58

motorcycle.C:59

motorcycle.C:60

motorcycle.C:61

motorcycle.C:62

motorcycle.C:63

motorcycle.C:64

motorcycle.C:65

motorcycle.C:66

motorcycle.C:67

motorcycle.C:68

motorcycle.C:69

motorcycle.C:70

motorcycle.C:71

motorcycle.C:72

motorcycle.C:73

motorcycle.C:74

motorcycle.C:75

motorcycle.C:76

motorcycle.C:77

motorcycle.C:78

motorcycle.C:79

motorcycle.C:80

motorcycle.C:81

motorcycle.C:82

motorcycle.C:83

motorcycle.C:84

motorcycle.C:85

motorcycle.C:86

motorcycle.C:87

motorcycle.C:88

motorcycle.C:89

motorcycle.C:90

motorcycle.C:91

motorcycle.C:92

motorcycle.C:93

motorcycle.C:94

motorcycle.C:95

motorcycle.C:96

motorcycle.C:97

motorcycle.C:98

motorcycle.C:99

motorcycle.C:100

motorcycle.C:101

motorcycle.C:102

motorcycle.C:103

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

How do you draw in Dev c plus plus?

Download and install the WinBGIM Devpack. Once installed, you can include graphics.h to draw graphics.


Can visual basic compile a c plus plus program?

As much as your car can fly.


How do you draw a pixel of varying intensity on the screen using C Plus Plus?

C++ has nothing to do with pixels. Your question may be related with 'Windows programming' or 'DOS programming' or 'X Window System programming'.


How do you draw a concentric circle using C or C Plus Plus with the built-in graphic function?

You don't: the C and C++ languages do not have any built-in graphics tool. Further, it is impossible to draw a concentric circle. Multiple circles are concentric when they share the same center.In C or C++, graphic functions such as the drawing of lines, rectangles or circles are provided through third party libraries, or through wrappers which provide access to the operating system's graphics functions.


How can you code a curve in c plus plus?

If you mean how do you draw a curve in C++, you can't. C++ does not have any built-in graphics support of any kind. All graphics are platform-specific so, to be able to draw graphics, you need a graphics API and library suitable for your platform and hardware. As a result, the code you use will not be portable. In most graphics libraries you will draw curves as a series of arcs, so you want to look up the arc() function in your library documentation.


What is b plus b plus b plus c plus c plus c plus c?

b+b+b+c+c+c+c =3b+4c


What is c plus c plus 2c plus c plus c equal?

c + c + 2c + c + c = 6c


B plus b plus b plus c plus c plus c plus c equals?

b + b + b + c + c + c + c = 3b + 4c


Symplify c plus c plus c plus c?

4c


What is c plus c plus c plus c plus c?

c + c + c + c + c = 5 * c.


How do you draw a sphere in computer graphics using C plus plus?

C++ is a generic, cross-platform language, but graphics are platform-dependant. thus C++ has no built-in methods for graphics output. To draw graphics in C++ you need a low-level API and library specific to the platform and hardware you intend to target. Some libraries are highly abstract and therefore support cross-platform development, but most are platform-specific. Consult the documentation that came with your library.


How do you show square root symbol in C plus plus code?

The square root symbol is Unicode 0x221A. To show it, you either need to draw it graphically, or you need to have a Unicode representation library.