1. 15 though early morning of 16 April

    Date: 04/16/16     Keywords: no keywords

    I began a reading of "Artemis Fowl". RS said it reminds her of the strangely non-sexual, intense relationship between Lucky and Nrsc. I read to "Ciao, fulletta" in Chapter 3 ("Holly") and by the end of page 61 (The Hummingbird Full Moon Rirual) was too much for me. The time was 1922hrs, I dressed, secured S15 and caught the OL for lemon Grove. I spent the evening and early morning (16 April) in the garage of the Blue Bird Street house mostly doing some non-LEPrecon inter net surfing. The most recent meeting of The Honey Bee Writing Club is scheduled for 1500hrs in The MVL. I thought yesterday it was an ACC meeting. Wrong, it is to be The HBW Club. I cannot even begin to gues what the meeting shall accomplish. RS and I are not in the Club. Beth G is taking care of her little girl plus Dsrvl`s three children. We do not expect her to come, unless Charlene agrees to help. Aldous for unknown reasons is with CFS and Speadtle somewhere near Palomar Mountain.

    As NR would say...
    Now you know what I know
    WS Campbell, Inspector
    Duty Officer
    OPD
    TDY/ NYD OIG FR

    Source: http://algorithms.livejournal.com/105538.html

  2. Divide a circle

    Date: 05/11/11     Keywords: programming

    Hi!
    I've been member of this community for quite time, and now I need some advise.

    Question is how do I devide given circle with radius R into N vertical segments with same area?
    And by vertical I mean that devising lines should be parralell to the diametr line of that circle. One more thing - N is always even. Simple example is N = 2 : and we have circle divided vertically into two parts of equal area with deametr line.

    I need this to speedup my litlle research on mathematical statistics with parallel GPU eval.

    Any help In form of formula, or ref to the known algorithm (if it does exists) or some code on almost any programming language would be g8.

    UPD
    Illustration added. Case: R=1 N=6, areas of all segments are equal.
    I need to know OX points marked with question marks.
    Photobucket

    Source: http://algorithms.livejournal.com/105444.html

  3. Contributing without even knowing

    Date: 08/06/10     Keywords: software, web

    Flash animations on webpages consume a surprisingly large amount of CPU time, especially if you keep many pages open at once. When you think about it, this is a very fast and efficient way to distribute some software onto a lot of computers. Put up a banner on a major news site and you have your code ticking along on thousands of computers within minutes, and with no user interaction.

    It's strange that distributed computing has not leapt onto this. Granted, it's a narrow nieche, with the program running only for a few minutes and with a limited size, but there are still plenty of cases where it could work. I've only found This proof of concept of distributed flash computing. This example require some user interaction and fills a whole screen, but there seems to be no reason why it couldn't run as a banner ad.

    Why isn't this more widespread?

    Source: http://algorithms.livejournal.com/104162.html

  4. keystream

    Date: 05/07/10     Keywords: web

    Dear lazy web,

    Do you know if there exists any keystream algorithms where in which, given an input key, you can request from the algorithm something like "give me slot 433"?

    Let me clarify,
    so a typical keystream you seed with some key and then are able to request sequential bytes. In my particular application I want to encrypt 8Kbytes xored against a keystream but have it so it can be randomly read and written to. So I guess it would be like a key-block cipher or something like that. I don't fancy re-implementing crypto so I'm wondering if such a technique exists out there.

    Source: http://algorithms.livejournal.com/103730.html

  5. Looking for a job. java team lead / system architect

    Date: 03/13/10     Keywords: java

    Hi!

    At the moment I am looking for a job of java team lead / system architect.
    CV
    http://www.chantingwolf.narod.ru/cv8en.doc
    LinkedIN profile
    http://www.linkedin.com/in/mykbova

    -Mykola

    Source: http://algorithms.livejournal.com/103492.html

  6. 1st Call for Papers: SIGAI Workshop on Emerging Research Trends in AI (ERTAI-2010)

    Date: 01/09/10     Keywords: php, asp, java, web, spam

    The Special Interest Group on AI (SIGAI) of Computer Society of India (CSI) announces a *workshop* on "Emerging Research Trends in AI". The workshop will be organised and hosted by CDAC Navi Mumbai, India and is meant to encourage quality research in various aspects of AI, among the Indian academia/industry. For details, refer the first call for papers below (in the LJ Cut), and visit http://sigai.cdacmumbai.in and http://sigai.cdacmumbai.in/index.php/ertai-2010

    [Cross-posted at mumbai , ai_research and _scientists_ ]

    SIGAI Workshop on Emerging Research Trends in Artificial Intelligence (ERTAI - 2010)
    17th April, 2010, C-DAC, Navi Mumbai, India
    Supported by Computer Society of India (CSI)

    Background

    Artificial Intelligence (AI) has always been a research-rich field with a number of challenging and practically significant problems spanning many areas. These include language processing, multi-agent systems, web mining, information retrieval, semantic web, e-learning, optimization problems, pattern recognition, etc. AI, hence, can offer a wide range of challenging problems matching the palate of every academic or professional. However, most colleges and universities do not have experienced AI researchers to work in these areas.

    We also observe an increasing interest among the Indian academia to pursue research, usually aimed at PhD. However, lack of guides with rich research experience often makes it hard for new and aspiring research scholars to identify relevant and useful research topics and to get guidance on their approach and direction. A forum where those pursuing research can exchange ideas and seek guidance, and those seeking to get into research can get a feel of current research would be valuable for both groups.

    This is the backdrop driving SIGAI to organize a workshop of this nature.

    Proposed Structure of Workshop

    It will be a one day programme consisting of,

    * Invited talks covering current trends, specific challenges, etc. in Artificial Intelligence
    * Invited talks on mentoring research scholars on publication, research methodology, etc.
    * Presentations by those currently pursuing research in AI area.

    We will have a panel of experienced researchers to evaluate and mentor the research presentations.

    Call For Papers

    For the research presentations, we are now inviting brief research papers of 5-6 pages, outlining the problem being addressed, approach followed vis a vis existing approaches, current status / results, and future plans. A subset will be short-listed for presentation, based on a formal review process. Papers must have significant AI content to be considered for presentation. Relevant topics include (but are not limited to):

    Knowledge Representation
    Reasoning

    Model-Based Learning
    Expert Systems

    Data Mining
    State Space Search

    Cognitive Systems
    Vision & Perception

    Intelligent User Interfaces
    Reactive AI

    Ambient Intelligence
    Artificial Life

    Evolutionary Computing
    Fuzzy Systems

    Uncertainty in AI
    Machine Learning

    Constraint Satisfaction
    Ontologies

    Natural Language Processing
    Pattern Recognition

    Intelligent Agents
    Soft Computing

    Planning & Scheduling
    Neural Networks

    Case-Based Reasoning

    Target Audience

    Target audience will be primarily:

    * Faculty members pursuing research involving AI as the base or as a tool for an application.
    * Faculty members interested in pursuing research and exploring areas / options.
    * Research scholars working for a post graduate degree.
    * Students seriously interested in research, specifically on AI.

    Important Dates

    * Last date for paper submission: 10th March, 2010
    * Acceptance intimation: 25th March, 2010
    * Camera ready copy due: 5th April, 2010
    * Registration details announcement: 1st February, 2010

    Instructions

    * Presentations must report original work carried out by the authors.
    * Presenters would be given a maximum of 30 minutes for their presentation.
    * All participants must register for the workshop.
    * Presentation may be submitted via: csi.sigai@gmail.com This e- mail address is being protected from spambots. You need JavaScript enabled to view it

    ERTAI Secretariat
    Centre for Development of Advanced Computing (Formerly NCST)
    Raintree Marg, Near Bharati Vidyapeeth, Sector 7, CBD Belapur
    Opp. Kharghar Railway Station, Navi Mumbai 400 614, Maharashtra, INDIA

    Telephone: +91-22-27565303
    Fax: +91-22-27565004 (on request)

    Email: csi.sigai@gmail.com
    Web: http://sigai.cdacmumbai.in/

    Source: http://algorithms.livejournal.com/103407.html

  7. Finding the nearest in a sorted set of int to a given int

    Date: 12/05/09     Keywords: software, java

    Hi guys,

    I'm in the middle of writing a connector to some accounting software and I've been implementing a lazy loading list of proxies because I'm dealing with huge lists of items which load slowly (even the item id s load slowly).

    That's not important to the question I am asking though, basically, I want an algorithm which finds either the given search int in my sorted set (of indexes) or the nearest int contained in the list (it doesn't matter, but we can say that the algorithm has a preference for lower numbers if 2 values are equally near)

    The essence of the problem is outlined here:


    import java.util.TreeSet;

    public class Search {
    static TreeSet sorted = new TreeSet();

    public static void main(String...args){

    sorted.add(1);
    sorted.add(3);
    sorted.add(5);
    sorted.add(7);
    sorted.add(10);

    findNearest(2); // return 1
    findNearest(8); // return 7
    findNearest(10); // return 10
    }

    private static Integer findNearest(Integer search) {
    return null; //TODO halp pls!
    }
    }


    Thanks for any advice in advance!

    Source: http://algorithms.livejournal.com/103068.html

  8. Big-O for other parameters?

    Date: 05/21/09     Keywords: no keywords

    Is Big-O (and Omega and Theta) ever used for other algorithm cost parameters besides time? Like, could I usefully describe different presentation methodologies in terms of bandwidth consumption per n bytes of content as O (n log n) for example? Or is there a separate notation?

    Source: http://algorithms.livejournal.com/102864.html

  9. n-th order statistics of the immutable data

    Date: 03/04/09     Keywords: no keywords

    what's the best asymptotic time complexity for a n-th order statistics algorithm on the immutable array of size N with memory consumption less then or equal to O(log N)? median of medians algorithm gives O(N) time complexity in the worst case, but I'm not sure about it's memory boundaries for the r/o array

    UPD: anyway, it would be much interesting too for the case of the memory consumption less then or equal to O(sqrt N); or even O(K * N) where 0 < K << 1

    Source: http://community.livejournal.com/algorithms/101906.html

  10. n-th order statistics of the immutable data

    Date: 03/04/09     Keywords: no keywords

    what's the best asymptotic time complexity for a n-th order statistics algorithm on the immutable array of size N with memory consumption less then or equal to O(log N)? median of medians algorithm gives O(N) time complexity in the worst case, but I'm not sure about it's memory boundaries for the r/o array

    UPD: anyway, it would be much interesting too for the case of the memory consumption less then or equal to O(sqrt N); or even O(K * N) where 0 < K << 1

    Source: http://algorithms.livejournal.com/101906.html

  11. Partially sorted array

    Date: 02/08/09     Keywords: no keywords

    Let's say you have an array, which is sorted, and then some small number of the elements become corrupt, so the array is not sorted anymore. Is there some efficient way to sort it again that doesn't involve resorting the whole array? (You may not necessarily know which elements are corrupt)

    Source: http://community.livejournal.com/algorithms/101636.html

  12. Partially sorted array

    Date: 02/08/09     Keywords: no keywords

    Let's say you have an array, which is sorted, and then some small number of the elements become corrupt, so the array is not sorted anymore. Is there some efficient way to sort it again that doesn't involve resorting the whole array? (You may not necessarily know which elements are corrupt)

    Source: http://algorithms.livejournal.com/101636.html

  13. Pseudo-random dice

    Date: 01/30/09     Keywords: html, java

    I’m hoping someone here might know why this is not working as expected. I’m attempting to generate pseudo-random throws of dice in Java. In each round I generate 15 values from 1 to 6. From the player’s perspective, 5 dice are rolled, and any or all of them may be re-rolled one or twice. I implement this by taking the first roll from the first 5 values, whichever dice are not held on the first re-roll from the corresponding 6th to 10th values, and whichever are not held on the second re-roll from the 11th to 15th values.

    I became suspicious that something was not right, and I believe I have shown that to be so. I’ve tried two sources of random numbers: one is the Random class built into Java (which is a linear congruential generator); the other is an implementation of the Mersenne twister. Both exhibit the same anomalies, so I presume the fault must lie in the routine that reduces the range to six integers, which is common to both.

    package randomtest;
    import net.goui.util.MTRandom;  // http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/VERSIONS/JAVA/MTRandom.java
    import java.util.Random;        // http://java.sun.com/j2se/1.4.2/docs/api/java/util/Random.html
    
    public class Main {
        
        static class Roller {
            Random rng = new Random();           // alternate: new MTRandom()
            static int roll[] = new int[15];
            Roller() {
            }
            public void start() {for (int i=0; i<15; ++i) roll[i] = rng.nextInt(6) + 1;}
        }
    
        static Roller roller = new Roller();
        static int freq12[]  = {0, 0, 0, 0, 0, 0, 0};
        static int freq13[]  = {0, 0, 0, 0, 0, 0, 0};
        static int freq23[]  = {0, 0, 0, 0, 0, 0, 0};
        static int freq123[] = {0, 0, 0, 0, 0, 0, 0};
        
        public static void main(String[] args) {
        
            for (int n = 0; n < 10000000; ++n) {
                roller.start();
                for (int i=0; i<5; ++i) {
                    int r1 = Roller.roll[i];
                    int r2 = Roller.roll[i+5];
                    int r3 = Roller.roll[i+10];
                    if (r1 == r2) ++freq12[Roller.roll[r1]];
                    if (r1 == r3) ++freq13[Roller.roll[r1]];
                    if (r2 == r3) ++freq23[Roller.roll[r2]];
                    if (r1 == r2 && r2 == r3) ++freq123[Roller.roll[r2]];
                }
                if ((n+1)%1000000 == 0) System.out.println("Trial " + (n+1) + ".");
            }
    
            System.out.println("Expected is: 1388889 / 1388889 / 1388889 / 231481.");
            for (int n=1;n<7;++n)
                System.out.println("Frequency of " + n + " repeating = "
                    + freq12[n] + " / " + freq13[n] + " / " + freq23[n] + " / " + freq123[n] + ".");
        }
    
    }
    
    ================================================================
    
    Using java.util.Random:
    
    Expected is: 1388889 / 1388889 / 1388889 / 231481.
    Frequency of 1 repeating = 1388407 / 1479475 / 1293479 / 230274.
    Frequency of 2 repeating = 1388173 / 1479752 / 1295680 / 231701.
    Frequency of 3 repeating = 1388272 / 1482455 / 1295064 / 231626.
    Frequency of 4 repeating = 1389251 / 1482245 / 1299079 / 232087.
    Frequency of 5 repeating = 1386727 / 1205065 / 1574504 / 231813.
    Frequency of 6 repeating = 1387655 / 1201628 / 1573153 / 230599.
    
    Expected is: 1388889 / 1388889 / 1388889 / 231481.
    Frequency of 1 repeating = 1388231 / 1481334 / 1294928 / 231923.
    Frequency of 2 repeating = 1389308 / 1480868 / 1296429 / 230650.
    Frequency of 3 repeating = 1388965 / 1479818 / 1295699 / 230441.
    Frequency of 4 repeating = 1390373 / 1483708 / 1295996 / 231994.
    Frequency of 5 repeating = 1388448 / 1203915 / 1574332 / 232041.
    Frequency of 6 repeating = 1387842 / 1204130 / 1573698 / 230794.
    
    Expected is: 1388889 / 1388889 / 1388889 / 231481.
    Frequency of 1 repeating = 1389463 / 1480259 / 1295834 / 231346.
    Frequency of 2 repeating = 1390002 / 1481980 / 1295481 / 231499.
    Frequency of 3 repeating = 1391705 / 1482439 / 1296473 / 232614.
    Frequency of 4 repeating = 1387626 / 1481225 / 1296746 / 231314.
    Frequency of 5 repeating = 1388892 / 1203113 / 1572535 / 231855.
    Frequency of 6 repeating = 1389320 / 1205755 / 1573967 / 231393.
    
    ================================================================
    
    Using net.goui.util.MTRandom:
    
    Expected is: 1388889 / 1388889 / 1388889 / 231481.
    Frequency of 1 repeating = 1387599 / 1483090 / 1297874 / 231546.
    Frequency of 2 repeating = 1388028 / 1479094 / 1295584 / 230952.
    Frequency of 3 repeating = 1388372 / 1481956 / 1295757 / 231383.
    Frequency of 4 repeating = 1388979 / 1481177 / 1296873 / 231376.
    Frequency of 5 repeating = 1389075 / 1204569 / 1573831 / 231396.
    Frequency of 6 repeating = 1389061 / 1204809 / 1574539 / 232224.
    
    Expected is: 1388889 / 1388889 / 1388889 / 231481.
    Frequency of 1 repeating = 1389284 / 1481200 / 1296447 / 231230.
    Frequency of 2 repeating = 1391831 / 1480311 / 1295396 / 231499.
    Frequency of 3 repeating = 1388017 / 1483176 / 1295311 / 231774.
    Frequency of 4 repeating = 1390365 / 1481329 / 1295701 / 231424.
    Frequency of 5 repeating = 1388466 / 1204211 / 1573249 / 231480.
    Frequency of 6 repeating = 1387819 / 1204227 / 1571301 / 230896.
    
    Expected is: 1388889 / 1388889 / 1388889 / 231481.
    Frequency of 1 repeating = 1386641 / 1481585 / 1294466 / 231443.
    Frequency of 2 repeating = 1388663 / 1481050 / 1295534 / 231235.
    Frequency of 3 repeating = 1389067 / 1481547 / 1296505 / 232172.
    Frequency of 4 repeating = 1390075 / 1482439 / 1298168 / 232068.
    Frequency of 5 repeating = 1388224 / 1203076 / 1574220 / 230492.
    Frequency of 6 repeating = 1389230 / 1203987 / 1575746 / 231630.

    I previously tested the frequencies of each number — they are as expected; but there seems to be correlation between values in certain positions in the 15-number groups I’m generating, and I don’t know why, nor how to go about eliminating it.

    Any insight and/or advice would be greatly appreciated.

    Source: http://community.livejournal.com/algorithms/101403.html

  14. Pseudo-random dice

    Date: 01/30/09     Keywords: html, java

    I’m hoping someone here might know why this is not working as expected. I’m attempting to generate pseudo-random throws of dice in Java. In each round I generate 15 values from 1 to 6. From the player’s perspective, 5 dice are rolled, and any or all of them may be re-rolled one or twice. I implement this by taking the first roll from the first 5 values, whichever dice are not held on the first re-roll from the corresponding 6th to 10th values, and whichever are not held on the second re-roll from the 11th to 15th values.

    I became suspicious that something was not right, and I believe I have shown that to be so. I’ve tried two sources of random numbers: one is the Random class built into Java (which is a linear congruential generator); the other is an implementation of the Mersenne twister. Both exhibit the same anomalies, so I presume the fault must lie in the routine that reduces the range to six integers, which is common to both.

    package randomtest;
    import net.goui.util.MTRandom;  // http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/VERSIONS/JAVA/MTRandom.java
    import java.util.Random;        // http://java.sun.com/j2se/1.4.2/docs/api/java/util/Random.html
    
    public class Main {
        
        static class Roller {
            Random rng = new Random();           // alternate: new MTRandom()
            static int roll[] = new int[15];
            Roller() {
            }
            public void start() {for (int i=0; i<15; ++i) roll[i] = rng.nextInt(6) + 1;}
        }
    
        static Roller roller = new Roller();
        static int freq12[]  = {0, 0, 0, 0, 0, 0, 0};
        static int freq13[]  = {0, 0, 0, 0, 0, 0, 0};
        static int freq23[]  = {0, 0, 0, 0, 0, 0, 0};
        static int freq123[] = {0, 0, 0, 0, 0, 0, 0};
        
        public static void main(String[] args) {
        
            for (int n = 0; n < 10000000; ++n) {
                roller.start();
                for (int i=0; i<5; ++i) {
                    int r1 = Roller.roll[i];
                    int r2 = Roller.roll[i+5];
                    int r3 = Roller.roll[i+10];
                    if (r1 == r2) ++freq12[Roller.roll[r1]];
                    if (r1 == r3) ++freq13[Roller.roll[r1]];
                    if (r2 == r3) ++freq23[Roller.roll[r2]];
                    if (r1 == r2 && r2 == r3) ++freq123[Roller.roll[r2]];
                }
                if ((n+1)%1000000 == 0) System.out.println("Trial " + (n+1) + ".");
            }
    
            System.out.println("Expected is: 1388889 / 1388889 / 1388889 / 231481.");
            for (int n=1;n<7;++n)
                System.out.println("Frequency of " + n + " repeating = "
                    + freq12[n] + " / " + freq13[n] + " / " + freq23[n] + " / " + freq123[n] + ".");
        }
    
    }
    
    ================================================================
    
    Using java.util.Random:
    
    Expected is: 1388889 / 1388889 / 1388889 / 231481.
    Frequency of 1 repeating = 1388407 / 1479475 / 1293479 / 230274.
    Frequency of 2 repeating = 1388173 / 1479752 / 1295680 / 231701.
    Frequency of 3 repeating = 1388272 / 1482455 / 1295064 / 231626.
    Frequency of 4 repeating = 1389251 / 1482245 / 1299079 / 232087.
    Frequency of 5 repeating = 1386727 / 1205065 / 1574504 / 231813.
    Frequency of 6 repeating = 1387655 / 1201628 / 1573153 / 230599.
    
    Expected is: 1388889 / 1388889 / 1388889 / 231481.
    Frequency of 1 repeating = 1388231 / 1481334 / 1294928 / 231923.
    Frequency of 2 repeating = 1389308 / 1480868 / 1296429 / 230650.
    Frequency of 3 repeating = 1388965 / 1479818 / 1295699 / 230441.
    Frequency of 4 repeating = 1390373 / 1483708 / 1295996 / 231994.
    Frequency of 5 repeating = 1388448 / 1203915 / 1574332 / 232041.
    Frequency of 6 repeating = 1387842 / 1204130 / 1573698 / 230794.
    
    Expected is: 1388889 / 1388889 / 1388889 / 231481.
    Frequency of 1 repeating = 1389463 / 1480259 / 1295834 / 231346.
    Frequency of 2 repeating = 1390002 / 1481980 / 1295481 / 231499.
    Frequency of 3 repeating = 1391705 / 1482439 / 1296473 / 232614.
    Frequency of 4 repeating = 1387626 / 1481225 / 1296746 / 231314.
    Frequency of 5 repeating = 1388892 / 1203113 / 1572535 / 231855.
    Frequency of 6 repeating = 1389320 / 1205755 / 1573967 / 231393.
    
    ================================================================
    
    Using net.goui.util.MTRandom:
    
    Expected is: 1388889 / 1388889 / 1388889 / 231481.
    Frequency of 1 repeating = 1387599 / 1483090 / 1297874 / 231546.
    Frequency of 2 repeating = 1388028 / 1479094 / 1295584 / 230952.
    Frequency of 3 repeating = 1388372 / 1481956 / 1295757 / 231383.
    Frequency of 4 repeating = 1388979 / 1481177 / 1296873 / 231376.
    Frequency of 5 repeating = 1389075 / 1204569 / 1573831 / 231396.
    Frequency of 6 repeating = 1389061 / 1204809 / 1574539 / 232224.
    
    Expected is: 1388889 / 1388889 / 1388889 / 231481.
    Frequency of 1 repeating = 1389284 / 1481200 / 1296447 / 231230.
    Frequency of 2 repeating = 1391831 / 1480311 / 1295396 / 231499.
    Frequency of 3 repeating = 1388017 / 1483176 / 1295311 / 231774.
    Frequency of 4 repeating = 1390365 / 1481329 / 1295701 / 231424.
    Frequency of 5 repeating = 1388466 / 1204211 / 1573249 / 231480.
    Frequency of 6 repeating = 1387819 / 1204227 / 1571301 / 230896.
    
    Expected is: 1388889 / 1388889 / 1388889 / 231481.
    Frequency of 1 repeating = 1386641 / 1481585 / 1294466 / 231443.
    Frequency of 2 repeating = 1388663 / 1481050 / 1295534 / 231235.
    Frequency of 3 repeating = 1389067 / 1481547 / 1296505 / 232172.
    Frequency of 4 repeating = 1390075 / 1482439 / 1298168 / 232068.
    Frequency of 5 repeating = 1388224 / 1203076 / 1574220 / 230492.
    Frequency of 6 repeating = 1389230 / 1203987 / 1575746 / 231630.

    I previously tested the frequencies of each number — they are as expected; but there seems to be correlation between values in certain positions in the 15-number groups I’m generating, and I don’t know why, nor how to go about eliminating it.

    Any insight and/or advice would be greatly appreciated.

    Source: http://algorithms.livejournal.com/101403.html

  15. Computer Graphics - Java

    Date: 01/13/09     Keywords: java

    Some backstory for those willing to kindly help me interpret the below java code.

    The class is Computer Graphics. What we did in the class was to basically reinvent the wheel; well, the java Graphics2D and Graphics3D API (except... badly) In our projects we managed to master (dun dun DUN!) 3D cubes and viewpoints, hidden surfaces, shaded surfaces and hidden line removal (ta da!) and an insane amount of inheritance. For this question we have to discuss how we might represent a class to represent a cylinder using flat surfaces (where Surface3D inherits from many simple classes: Drawing3D, Line3D to Point3D) to approximate to the figure. 

    So far I have established that the paramaters used to specify the cylinder will be: center point, diameter, length and position. An ArrayList data structure will be appropriate for the cylinder and how I will do the class in English. I had a look at the sample answer and I found some java code which I've since been puzzling over because I'm not 100% sure what on earth it's doing.

    double cylinder_length = 4; will allow us to specify the length of the cylinder, the length between the two symetrical circles on the axis
    double oldx = 1; old x and y co-ordinates that can be saved so we do calculations on previous co-ordinates not the first co-ords.
    double oldy = 0;
    int n = 32; the set number of points I want around the circle, can be increased to create a smoother surface.

     for (int i = n; i>=0; i--){

    double theta = (double)(((double)i/n)*Math.PI *2); 
    double x = (double)Math.cos (theta); 
    double y = (double)Math.sin (theta); 

    Surface3D temp = new Surface3D(); this is us creating a new surface of type surface3D. The "base surface"
    cylinder.addGItem(temp);  hierarchy crap that I don't understand but know to do
    temp.addPoint(oldx,oldy,0); we are adding the old x, y (0 on the z-axis because the cylinder will start on the xy corords, we aren't rotating it around z) to the circle... making the circle?
    temp.addPoint(x,y,0); now adding the next points x and y on the circle calculated above ^
    temp.addPoint(x,y,cylinder_length); adding the points x and y identically to the second circle down the z-axis (toward us or away from us depending on the view point)
    temp.addPoint(oldx,oldy,cylinder_length); adding the second point on the z-axis that reflects the old xy and y coords
    oldx = x; sex new co-ordinates x and y to the old so the new calulations can be done on the new co-ords not the first
    oldy = y;

    }//for i

    Surface3D cylinder_front = new Surface3D(); defining the front of the cylinder that will be able to be seen as a new surface
    Surface3D cylinder_back = new Surface3D(); same to the back that should be invisible
    cylinder.addGItem(cylinder_front); adding both front and back to cylinder
    cylinder.addGItem(cylinder_back);

    /*

    * which is all fine and well... but then...eh?
    */

    for (int i = n; i>=0; i--){
     

    double theta = (double)(((double)i/n)*Math.PI *2);
    double x = (double)Math.cos (theta);
    double y = (double)Math.sin (theta);

    System.out.println("theta: " +theta + ", x:"+x+", y:"+y); just printing the values of theta, x and y

    cylinder_front.addPoint(x,y,0); I have no idea why we're doing this.... connecting the back co-ords to the front, perhaps? to create the cylinder?
    cylinder_back.addPoint(x,y,cylinder_length);

    oldx = x;
    oldy = y;

    }//for i
     

    I'm not sure if I'm understanding it correctly or not and I'm quite inexperienced in understanding code by others mainly because I doubt that I'll get it or not.

    Thanks in advance for reading!
     

    Source: http://community.livejournal.com/algorithms/101364.html

  16. Computer Graphics - Java

    Date: 01/13/09     Keywords: java

    Some backstory for those willing to kindly help me interpret the below java code.

    The class is Computer Graphics. What we did in the class was to basically reinvent the wheel; well, the java Graphics2D and Graphics3D API (except... badly) In our projects we managed to master (dun dun DUN!) 3D cubes and viewpoints, hidden surfaces, shaded surfaces and hidden line removal (ta da!) and an insane amount of inheritance. For this question we have to discuss how we might represent a class to represent a cylinder using flat surfaces (where Surface3D inherits from many simple classes: Drawing3D, Line3D to Point3D) to approximate to the figure. 

    So far I have established that the paramaters used to specify the cylinder will be: center point, diameter, length and position. An ArrayList data structure will be appropriate for the cylinder and how I will do the class in English. I had a look at the sample answer and I found some java code which I've since been puzzling over because I'm not 100% sure what on earth it's doing.

    double cylinder_length = 4; will allow us to specify the length of the cylinder, the length between the two symetrical circles on the axis
    double oldx = 1; old x and y co-ordinates that can be saved so we do calculations on previous co-ordinates not the first co-ords.
    double oldy = 0;
    int n = 32; the set number of points I want around the circle, can be increased to create a smoother surface.

     for (int i = n; i>=0; i--){

    double theta = (double)(((double)i/n)*Math.PI *2); 
    double x = (double)Math.cos (theta); 
    double y = (double)Math.sin (theta); 

    Surface3D temp = new Surface3D(); this is us creating a new surface of type surface3D. The "base surface"
    cylinder.addGItem(temp);  hierarchy crap that I don't understand but know to do
    temp.addPoint(oldx,oldy,0); we are adding the old x, y (0 on the z-axis because the cylinder will start on the xy corords, we aren't rotating it around z) to the circle... making the circle?
    temp.addPoint(x,y,0); now adding the next points x and y on the circle calculated above ^
    temp.addPoint(x,y,cylinder_length); adding the points x and y identically to the second circle down the z-axis (toward us or away from us depending on the view point)
    temp.addPoint(oldx,oldy,cylinder_length); adding the second point on the z-axis that reflects the old xy and y coords
    oldx = x; sex new co-ordinates x and y to the old so the new calulations can be done on the new co-ords not the first
    oldy = y;

    }//for i

    Surface3D cylinder_front = new Surface3D(); defining the front of the cylinder that will be able to be seen as a new surface
    Surface3D cylinder_back = new Surface3D(); same to the back that should be invisible
    cylinder.addGItem(cylinder_front); adding both front and back to cylinder
    cylinder.addGItem(cylinder_back);

    /*

    * which is all fine and well... but then...eh?
    */

    for (int i = n; i>=0; i--){
     

    double theta = (double)(((double)i/n)*Math.PI *2);
    double x = (double)Math.cos (theta);
    double y = (double)Math.sin (theta);

    System.out.println("theta: " +theta + ", x:"+x+", y:"+y); just printing the values of theta, x and y

    cylinder_front.addPoint(x,y,0); I have no idea why we're doing this.... connecting the back co-ords to the front, perhaps? to create the cylinder?
    cylinder_back.addPoint(x,y,cylinder_length);

    oldx = x;
    oldy = y;

    }//for i
     

    I'm not sure if I'm understanding it correctly or not and I'm quite inexperienced in understanding code by others mainly because I doubt that I'll get it or not.

    Thanks in advance for reading!
     

    Source: http://algorithms.livejournal.com/101364.html

  17. Новое ЖЖ сообщество / New LJ community.

    Date: 12/07/08     Keywords: no keywords

    j2ee.
    '[info]'j2ee_ua

    Source: http://community.livejournal.com/algorithms/100837.html

  18. Новое ЖЖ сообщество / New LJ community.

    Date: 12/07/08     Keywords: no keywords

    j2ee.
    j2ee_ua

    Source: http://algorithms.livejournal.com/100837.html

  19. Multi-level Markov chains

    Date: 10/28/08     Keywords: no keywords

    A well-known algorithm for generating humorous texts using Markov chains is exist.
    For example:
    http://www.eblong.com/zarf/markov/
    This algorithm is very simple and it is working only at word level.
    What if I would like to have such algorithm, which works not only at word level, but also at sentence level.
    It can be said that this algorithm remix words randomly. So then, I would like to remix sentences first, then words inside of each sentences.
    At top level, statistical table for sentences will be build. At lower level: table for words.
    But how to connect these two levels?
    Probably, something already exist in theory, not just for humorous texts.
    Thanks in advance for any comment about where to read more.

    Source: http://community.livejournal.com/algorithms/100435.html

  20. Convergence of graph colouring

    Date: 07/04/08     Keywords: no keywords

    I am coloring a graph's nodes, based on a set of initial conditions and rules of the form "if colors of a node's neighbours are like this, then color of the node is that": so, a cellular automaton on the graph.
    For simplicity, let us consider the graph to be acyclic and restrict the rules so that a node's color depends only on the colors of its child nodes.

    What are the methods of exploring convergence and soundness of such a system of rules?

    To put it easier, how to know, for a given system of rules, whether there exists a unique coloring satisfying them, and whether it is reachable by the following algorithm: "take any node, apply rules to it, repeat until convergence"?

    Source: http://community.livejournal.com/algorithms/99911.html

  ||  Next page


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home