Jump to content

File:Conchospiral.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file (SVG file, nominally 900 × 675 pixels, file size: 92 KB)

Summary

Description
English: The conchospiral curve computed using C language and displayed and saved using PLplot library.
Source Own work
Author Krishnavedala

Source Code

#include <omp.h>
#include <stdio.h>
#include <math.h>
#include <plplot/plplot.h>

#define        NUM_PTS        500
#define        THETA0    M_PI
  
int main (void)
{
    char txtBuffer[30];
    PLFLT *X=NULL, *Y=NULL, *Z=NULL;
    X = (PLFLT*) malloc(NUM_PTS * sizeof(PLFLT*));
    Y = (PLFLT*) malloc(NUM_PTS * sizeof(PLFLT*));
    Z = (PLFLT*) malloc(NUM_PTS * sizeof(PLFLT*));
    if(X == NULL || Y == NULL)
    {perror("Unable to allocate memory space!"); exit(-1);}
   
    plstart("wxwidgets",1,1);
    plscol0(0, 255, 255, 255);
    plscol0(15, 0, 0, 0);
    plcol(15);
   
    unsigned int count=0;
    float temp, theta=-THETA0;
    int col = 1;
    float xmin=0.f, xmax=0.f, ymin=0.f, ymax = 0.f, zmin=0.f, zmax = 0.f;
    const float mu = 1.07, a = 1., c = 1.1;
    #pragma omp for
    for(count = 0; count < NUM_PTS; count++)
    {
        temp = pow(mu,theta);
        X[count] = temp * a * cos(theta);
        Y[count] = temp * a * sin(theta);
        Z[count] = temp * c;
        xmin = (xmin < X[count]) ? xmin : X[count];
        xmax = (xmax > X[count]) ? xmax : X[count];
        ymin = (ymin < Y[count]) ? ymin : Y[count];
        ymax = (ymax > Y[count]) ? ymax : Y[count];
        zmin = (zmin < Z[count]) ? zmin : Z[count];
        zmax = (zmax > Z[count]) ? zmax : Z[count];
        theta += (20*THETA0/NUM_PTS);
    }
    pladv(0);
    plvpor( 0.0, 1.0, 0.0, 0.9 );
    plwind( -1.0, 1.0, -1.0, 1.5 );
    plw3d( 1.0, 1.0, 1.2, xmin, xmax, ymin, ymax, zmin, zmax, 50, 35 );
    plbox3( "bstu", "x axis", 0.0, 0,
            "bstu", "y axis", 0.0, 0,
            "bstu", "z axis", 0.0, 4 );
    plcol(col); plline3(NUM_PTS,X,Y,Z); plcol(15);
    sprintf(txtBuffer, "Conchospiral (#fs#gm=%.2f, a=%1.1f, c=%1.1f#fs)", mu, a, c);
    plptex(0.,1.3, 0, 0, .5, (const char*)txtBuffer);
    plend();
   
    free(X); free(Y); free(Z);
    return 0;
}

Licensing

I, the copyright holder of this work, hereby publish it under the following licenses:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
You may select the license of your choice.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

image/svg+xml

63dbf3e9a788971edb99aaf97141b42a280cc48f

94,119 byte

675 pixel

900 pixel

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current20:40, 1 December 2010Thumbnail for version as of 20:40, 1 December 2010900 × 675 (92 KB)Krishnavedala{{Information |Description={{en|1=The en:conchospiral curve computed using en:c programming language and displayed and saved using en:PLplot library.}} |Source={{own}} |Author=Krishnavedala |Date= |Permission= |other_

The following 3 pages use this file:

Global file usage

The following other wikis use this file: