Git Product home page Git Product logo

ray4's Introduction

Four-Space Visualization of 4D Objects

4D Hypercube 4D Octahedron Hypersphere Slices Hyperspheres

This repository contains my 1991 thesis (converted to HTML from the original nroff sources), as well as the original code for my 4D wireframe viewer and my 4D raytracer.

The thesis is now a single all-inclusive HTML file: Four-Space Visualization of 4D Objects.

See the thesis/ directory for my thesis source files and associated material.

Wire4

wire4 is my 4D wireframe viewer. It was written to run on an SGI Iris workstation. It reads in arbitrary 4D wireframes from a simple text file and displays them interactively. The code has not been maintained, though, and will not run on most modern computers.

Ray4

ray4 is the 4D raytracer. It is written in standard C, and reads from and writes to standard output, so should be able to run on most computers. The output is a 3D RGB image that can be displayed with a variety of methods.

GitHub Notes

You can send any questions to me at [email protected]. Also, now that GitHub has a discussions feature, feel free to start a conversation in the discussions section.

Other 4D Work

I'm contacted from time to time by others who have referenced my thesis or are embarking on 4D visualization work of their own. Here are links to other work I've seen.

ray4's People

Contributors

herbert-333 avatar hollasch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ray4's Issues

convert Ray4 output to PPM

Here's a simple slicer that converts to a PPM image stream.
I tested briefly piping to ffplay - from the ffmpeg project.
Note that it ignores aspect ratio.

#include <stdio.h>
#include <stdlib.h>

#include "r4_image.h"

struct S_IMAGEHDR header;

int main(int argc, char **argv)
{
  if (1 != fread(&header, sizeof(header), 1, stdin))
  {
    fprintf(stderr, "%s: failed to read header\n", argv[0]);
    return 1;
  }
  if (header.magic != R4_IMAGE_ID)
  {
    fprintf(stderr, "%s: header magic != Ray4\n", argv[0]);
    return 1;
  }
  if (header.version != 1)
  {
    fprintf(stderr, "%s: header version != 1\n", argv[0]);
    return 1;
  }
  if (header.bitsperpixel != 24)
  {
    fprintf(stderr, "%s: header bitsperpixel != 24\n", argv[0]);
    return 1;
  }
  int width  = header.last[0] - header.first[0] + 1;
  int height = header.last[1] - header.first[1] + 1;
  int depth  = header.last[2] - header.first[2] + 1;
  int bytes = 3 * width * height;
  char *buffer = malloc(bytes);
  if (! buffer)
  {
    fprintf(stderr, "%s: memory allocation failed\n", argv[0]);
  }
  for (int frame = 0; frame < depth; ++frame)
  {
    if (0 > printf("P6\n%d %d\n255\n", width, height))
    {
      fprintf(stderr, "%s: write error\n", argv[0]);
      free(buffer);
      return 1;
    }
    if (1 != fread(buffer, bytes, 1, stdin))
    {
      fprintf(stderr, "%s: read error\n", argv[0]);
      free(buffer);
      return 1;
    }
    if (1 != fwrite(buffer, bytes, 1, stdout))
    {
      fprintf(stderr, "%s: write error\n", argv[0]);
      free(buffer);
      return 1;
    }
  }
  free(buffer);
  return 0;
}

ray4 parser unexpected 0xfe

ray4 parser always says unexpected 0xfe, which comes from ReadChar returning -2 (the code for nothing in the un-read buffer).

Commit ed1f0fb did something bogus it seems, it needs to actually getc somewhere.

Embed image data into HTML file?

It might be useful to embed the images in the HTML file directly, rather than fetching out of a directory. That would yield a single HTML file that contains the entire thesis that people could download. Good excuse to investigate binary data encoding. For example, can the images be placed anywhere in the HTML file and then referenced in the body of the thesis?

V4_Normalize: dot product is used as norm

In file r4/src/r4_vec.c:

short V4_Normalize (Vector4 V)
{
    double norm; 

    norm = V4_Dot (V,V);

    if (norm < 1e-30) return 0;

    V4_Scalar (V, /=, norm);

    return 1;
}

Taking norm as dot product causes invalid lighting.

Sqrt of dot product should be taken

Get ray4 working on Windows

What's the output? Possibly a special 3D image file, plus a viewer that shows you a specific slice. Or generate movies. For the first iteration, do something crude and simple.

Link up all of the Markdown documents

Most of the READMEs are independent and thus there's no cohesive presentation of the project as a whole. Revisit the project structure and provide a better document collection for the whole and for each component.

linking fails (missing `-lm`)

As a CMake neophyte I'm not sure this is the best solution but it works for me:

diff --git a/ray4/CMakeLists.txt b/ray4/CMakeLists.txt
index 79cf8c9..a05d896 100644
--- a/ray4/CMakeLists.txt
+++ b/ray4/CMakeLists.txt
@@ -21,3 +21,4 @@ set ( sources_ray4
 )
 
 add_executable (ray4 ${sources_ray4})
+target_link_libraries(ray4 -lm)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.