COMP612 图形计算

Posted ulbrr19

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了COMP612 图形计算相关的知识,希望对你有一定的参考价值。


COMP612 Computer Graphics Programming
Semester 1, 2023
Project: Helicopter Scene
This is an individual assignment. All work you submit must be entirely your own. The assignment is
worth 70% and will be marked out of 100.
• You must work from the provided animationcontroller-lights.c template.
• You must complete the assignment in procedural C and freeGLUT (NOT C++).
• You must not use any external libraries other than freeGLUT.
• You must use Visual Studio 2022 and build/release an x86 (Win32) project.
• Your project proposal must have been approved by the course lecturer.
• Your final submitted code must compile, have graphical output, and run.
• All the above criteria must be met for the assignment to be graded.
Where your implementation idea or inspiration has been taken or adapted from other published
sources those sources should be acknowledged appropriately in the C file header and detailed in
your developer’s logbook.
It is expected that you will work consistently on this assignment, from hand out to due date. Time
will be allocated in class each week for you to ask questions, get help, and work on your assignment.
Please be aware that this is not an assignment that can be completed at the last minute. Each class
you will be exposed to new concepts, and as we work through these concepts you will be able to
progress your assignment.
1. Milestones:
Project Proposal – Due: 11:59 PM Tuesday 2nd May [week 8]
Progress Demo – Due: 11:59 PM Tuesday 16th May [week 10]
Final Submission – Due: 11:59 PM Tuesday 7th June 2022 [Week 13]
2. Final Submission:
You must submit your final project via the link provided on Canvas. Your submission must be a ZIP
file containing the following:
• Your Visual Studio 2022 solution, including all files necessary to build and run the animation.
• Your logbook entries, either as
o Scanned pages (as a single PDF file) from your handwritten logbook, or
o Your digital logbook saved as a PDF file.
3. Late Policy:
Late assignments, without an approved extension, will be subject to a deduction of 5% (one grade e.g.
from C+ to C) of the total mark available for each 24-hour period, or part thereof, up to a maximum
of five calendar days. Assignments over five days late will not normally be accepted or marked and
students will receive a DNC (Did Not Complete) for that assessment.
From the Office of Jacqueline Whalley, Associate Professor
<jwhalley@aut.ac.nz> | <+64 9 9219999 ext. 5203> Page 2 of 8
4. Unauthorised Collaboration:
Unauthorised collaboration means joint effort between students or students and others, in
preparing material submitted for assessment, except where this has been pre-approved by the
paper programme. Students are encouraged to discuss matters covered in classes, but the
expression of ideas and arguments must be the student’s own work.
5. Plagiarism:
Please be aware that any piece of your assessment may be tested with plagiarism
prevention software.
6. Marking:
You can fiCOMP612nd the marking rubric for this assignment on Canvas. Marking not only considers this
assignment specification, but also:
• the quality of the design of your code
• creativity, difficulty, and quality of your additional scene objects
• the quality of the animation and user control of the helicopter
• appropriate use of the template with code placed in the correct sections and functions as
documented in the template code and described in Modules 5 and 14.
7. Assignment Objectives:
Conceptualise, specify, and develop a significant OpenGL interactive animation in 3D, and:
 Appropriately scale an environment.
 Create a track-and-follow camera.
 Create and animate a hierarchical model.
 Effectively use lighting, materials, texturing, display lists, and fog.
 Implement smooth user interaction using keyboard controls.

From the Office of Jacqueline Whalley, Associate Professor
<jwhalley@aut.ac.nz> | <+64 9 9219999 ext. 5203> Page 3 of 8
Proposal Requirements (15 marks):
At this stage it is expected that you will have started the assignment and have rendered your
helicopter as a hierarchical model (Project Requirements Points 1 to 4 )
Now you are going to prepare a storyboard that illustrates your planned completed scene or
environment (see Point 11 in the Project Requirements) and how you will handle some of the more
advanced aspects of the project. An exemplar storyboard is provided on Canvas.
You should provide a descriptive overview of the theme of your scene (e.g. “My helicopter is a
search and rescue helicopter – it is searching a forest”). For this scene I might add water (a lake),
rocks, mountains, hunting/camping huts, and several types of trees. There are other objects that
could be considered too such as fish in the water or a weather particle system.
In addition, you must illustrate how you intend to address the following specified Project
Requirements:
 Animated Spotlight (see Point 7)
 Texture mapped objects: include example textures (see Point 8)
 Identify the scale of your objects and environment and mapping of real-world units to
OpenGL units (see Point 2)
 Animated object or effect (see Point 11)
Your proposal should be submitted to Canvas as a single PDF file on or before the due date.
Feedback will be provided via Canvas grades. If your proposal is approved, then you can go ahead
and get started with implementing the complete scene.
Demo Requirements (15 marks):
This milestone is a first walk & talk milestone or a work-in-progress demonstration of your working
animation. At this stage it is expected that you will have completed at least project requirements 1
to 5 and started working on requirement 6. This means that the helicopter is rendered, the rotors
are animating, and you have started on the helicopter movement (surge, sway, heave, and yaw).
Using Canvas Studio record a video of your animation and share it with your lecturer
(Jacqueline Whalley) on or before the due date and time. To use Studio, you will need
to download a small application first. Studio is intuitive to use and gives a nice result.
Alternatively, you may wish to record your video using your own preferred recording software,
upload the video to Canvas Studio and then share it with the lecturer.
The video should be between 45 and 60 seconds in length and show the current state of your
project. You should provide a voiceover as part of the video, and/or a textual note on your Canvas
submission, that highlights progress to date noting any shortcomings or difficulties encountered.
Note: In the unlikely event that you need help with how to use Canvas Studio, you can chat directly
with Canvas through a 24/7 live chat with a real person. You’ll find the link to this chat in Canvas,
under Help. You may also find 101 Canvas Help useful.
Feedback will be given via comments in Canvas Studio and a mark will be provided in your Canvas
grades.
From the Office of Jacqueline Whalley, Associate Professor
<jwhalley@aut.ac.nz> | <+64 9 9219999 ext. 5203> Page 4 of 8
Project Requirements (70 marks):
1. Getting Started
Download the animation template from Canvas (animationcontroller-lights.c). This
provides the lighting needed for 3D rendering and the FPS timing and key handling that is needed:
• for smooth animation
• to avoid overworking your CPUs and GPUs (this is especially important if your machine is a
gaming laptop – without it you will use one full core of the CPU and ~90%+ of your GPU).
You must work from this template and add your code in the appropriate sections as per the
template comments.
The template contains a function that sets-up basic OpenGL lighting for you. This is supplied because
when you start your project, we will not have covered lighting yet and lighting makes everything
look nice in 3D. Because we have lighting, we must use the GL_COLOR_MATERIAL mode for the
objects to be rendered using our usual RGB(A) colours. By default, GL_COLOR_MATERIAL is disabled.
You must in your final submission have changed the default lighting setup to your own as specified
in this document in Point 5. It is okay to use the default lighting for your demo video.
On Canvas there is an executable file of my basic helicopter that you can download and run to see
how your animation should behave. You may wish to extend and improve on this.
2. Basic Scene Settings
You should ensure that:
 you are using depth buffering and double buffering for your project.
 you are using a perspective projection and handling window reshape properly.
You must identify the scale of your objects and environment and mapping of real-world units to
OpenGL units. e.g.: if moving 1.0 units in the application what does this map to in the “real” world? 1
metre, 1 cm? Thinking about this now will make the positioning and animation of your objects
(including the camera) in the environment, and the projection parameters, easier to implement. This
scale must be detailed at the start of your logbook (e.g. “1.0 GL units = 1 metre”).
3. Basic Ground/Terrain
Construct a function that creates a grid of squares on the X-Z plane centred at the origin. The size of
the grid and the squares that make up the grid should be easy to change. The template includes a
key handler that toggles global variable renderFillEnabled whenever the ‘l’ key is pressed, to
allow the user to toggle between the scene been drawn wire-framed or filled. To make this work,
you must draw your scene wire-framed when renderFillEnabled is 0 and filled when
renderFillEnabled is 1.
Ground (Grid on XZ plane)
From the Office of Jacqueline Whalley, Associate Professor
<jwhalley@aut.ac.nz> | <+64 9 9219999 ext. 5203> Page 5 of 8
Set the clear colour to be a suitable colour for your sky.
4. Basic Helicopter – a Hierarchical Model
Use the built-in GLUT and GLU geometric shapes, and shapes specified by a vertex array, as well as
hierarchical modelling techniques to build a helicopter. That is, instead of just using an absolute
transformation from the world origin for each individual part, you should use a relative
transformation between an object and its parent in the hierarchy. For example, the tail should be
placed relative to the helicopter body coordinate system and the tail rotor should be placed relative
to the tail as should the sphere which caps the tail.
This hierarchical structure is critical in the long run for both modelling and animation, even if it might
seem like extra work at first! If you plan this carefully before you start coding you should have no
trouble.

Only use the OpenGL matrix transformations. Do not try to manipulate the model-view matrix
yourself. In the past students who have ignored this recommendation have not been able to
correctly view their model.
You do not have to make your helicopter look exactly like mine – just make sure you have at least
two rotors. You might want to look at various helicopter designs and choose one (e.g.: The SA330
Puma or an AutoGyro MT-03).
Hint: If you are using a perspective projection and have trouble positioning the parts of
your helicopter switch to an orthographic camera and implement key handlers that
allow you to view your chopper from all 6 sides by rotating using glRotated.
Hint: Draw your helicopter facing up the Z axis (i.e. so in the default orthographic
projection, the cockpit faces out of the screen toward you). This will make it much
simpler to use the keyboard controls built into the template.
From the Office of Jacqueline Whalley, Associate Professor
<jwhalley@aut.ac.nz> | <+64 9 9219999 ext. 5203> Page 6 of 8
5. Animating Your Helicopter Rotors
Now get your two rotors rotating at a reasonable RPM. Note the details of improved rotors in 6
below.
6. Helicopter Control & Tracking Camera
Make your helicopter fly:
• Surge  move forwards and backwards
• Sway  move from side to side (left and right—in game terms, “strafe”)
• Heave  move directly up and down
• Yaw  adjust its heading (turn left and right)
Whenever your helicopter moves your camera should move too (relative to the helicopter) so that
the camera is following the helicopter. Your Helicopter functions should be set up so that it can
easily be translated (moved) by using its variables (speed, heading, location etc.) and GL matrix
transforms. Unlike my demo, your helicopter should:
• not be able to move down below the ground.
• not leave the ground until the rotors are turning fast enough.
• slow the rotors on landing until they stop, or the user opts to take off again.
• start in the first instance with its rotors switched off.
Your control system must use the keys already defined in the template:
Key mapping:
--------------------------------------------
UP/DOWN ARROWS: Increase (move up) or decrease (move down) altitude (heave).
LEFT/RIGHT ARROWS: Turn left/right (yaw).
w/s: Move forward/backward (surge).
a/d: Strafe left/right (sway).
All of the movement controls must work simultaneously (e.g. if you hold down UP, W, and A, then
your helicopter must simultaneously move up, forward, and left). The template provides all of the
keyboard handling code required to do this, but you must work out how to move your helicopter in
the think() function.
Hint: Don’t forget to translate your rotor to the origin, then rotate, then translate back
(if necessary) or draw your rotor at the origin to rotate about a fixed (pivot) point and
then translate. If your rotors wobble when rotating, then they are not at the origin.
Hint: Use gluLookAt to focus on the helicopter and set the camera’s eye position relative
to the helicopter’s current location. For the camera to track the helicopter you need to
manage two things: the camera eye position must follow the helicopter in space, and
the camera must face toward the helicopter. As your helicopter rotates, the camera
should rotate with it – so if your camera looks along the tail toward the front, it should
stay looking along the tail as your helicopter turns left or right.
From the Office of Jacqueline Whalley, Associate Professor
<jwhalley@aut.ac.nz> | <+64 9 9219999 ext. 5203> Page 7 of 8
7. Lighting
Now it’s time to replace the simple lighting setup provided in the template with one that is
appropriate for your scene. You must make full use of the OpenGL fixed pipeline lighting functions
and include at least two different lights including:
 An animated spotlight (e.g., this could be attached to your helicopter or a lighthouse’s
rotating light)
 One directional light source with appropriate position, ambient, specular, and diffuse levels
All the objects in your scene, including your ground, must be affected by lighting.
8. Texture Mapping
You must use texture mapping to texture map at least two objects (one could be your floor/terrain).
For example, you might texture map: your sky, a hedge, a mat/rug, or a pond.
 You must use at least two different textures in your project.
 You can use any image textures you like (subject to copyright).
 You may not use an additional library to load the textures. You should use texture maps in
Portable Pixelmap (PPM) format. Textures in other formats can be converted to PPM using
IrfanView (a free image tool available at https://www.irfanview.com/ ).
 Turn texture mapping on only for texture mapped objects. If the objects are not texture
mapped, they should be drawn as shaded objects (using Materials as per point 9).
 Use texture mipmapping.
9. Materials
Where you are not employing texture mapping you should use Materials (not glColor). Set the
appropriate shininess, ambient, specular, and diffuse material properties for each object.
Hint: Ensure that you have normal vectors set by-vertex for all your objects. And for
your ground each vertex should have a normal attribute set so that lighting works. This
is easy if your ground is flat as the normal vector to the ground plane in the XZ plane is
simply (0,1,0) assuming that your camera has been set up correctly so that Y is up.
Hint: For materials to work don’t forget to disable GL_COLOR_MATERIAL by removing
the call to enable it in the template code. Remember with GL_COLOR_MATERIAL
enabled a call to glColor3f (1.0f, 0.0f, 0.0f); is the same as the following code
with GL_COLOR_MATERIAL disabled:
GLfloat red [3] = 1.0f, 0.0f, 0.0f ;
//change ambient and diffuse components to red
glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);

From the Office of Jacqueline Whalley, Associate Professor
<jwhalley@aut.ac.nz> | <+64 9 9219999 ext. 5203> Page 8 of 8
10. Fog
Use fog in some effective way within your environment. Think carefully about your fog colour. Fog is
typically used to do fading out/blend the scene into the distance and to hide edges. You might want
to alter fog colour and density based on the camera position to get the best effect for your scene.
11. A Complete Scene
Complete your environment by adding appropriate objects to the scene. For example: a forest,
buildings, lakes, etc. The objects you add will be dependent on your choice of scene and should be
consistent with the aesthetic of your scene. Enough objects and different types of objects should be
added to make the exploration of your environment interesting. At least one animated object (e.g. a
rotating windmill) or effect (e.g. a particle system for snow or rain) should be included. The
completed scene should match what you specified in your proposal milestone. If you deviate from
your proposed scene, you must seek approval from the course lecturer before beginning to
implement those changes.
You may wish to use low polygon OBJ mesh-models for some objects in your scene. This will not be
covered in our weekly studios, but a self-directed learning module on the OBJ file format and
reading in simple OBJ files is available on Canvas. Note: you don’t have to use an OBJ model. You can
use the built-in 3D shapes and hierarchical modelling to build objects for your scene. You might like
to look at this article https://sundaysundae.co/how-to-make-low-poly-look-good/ for inspiration.
12. Logbook
You must hand in your logbook as it forms part of your proof of authorship. Remember, the onus is
on you to prove you are the creator of your project; thorough record keeping is essential to this
process. Your logbook should record dates, time spent, a record of bugs and fixes, and design details.
You must provide a short statement in the last log entry that critically evaluates what you did well,
what you found most challenging, what you might do differently next time and identifies the
shortcomings of your application.
Hint: If your animation is slow you should consider:
Are you using multiple instances of the same object, like a tree? If yes, then you should
consider placing the object into a pre-compiled display list to optimise your animation.
Are you loading the same texture, or other assets, each render loop? Textures should only be
loaded once at the start of your animation in the init() callback function.
Are your texture files too big and slowing down the project loading time? If yes, consider
selecting or creating a smaller texture that is faster to load. 

 

如何使用 Java 解压缩 COMP-3 数字?

【中文标题】如何使用 Java 解压缩 COMP-3 数字?【英文标题】:How to unpack COMP-3 digits using Java? 【发布时间】:2013-12-03 04:17:27 【问题描述】:

我有巨大的大型机文件,并且该文件中有一些压缩数字。我想知道如何使用java解压后面的数字?

压缩数字:?

我阅读了解包数字的教程,发现以下规则来计算解包数字所需的字节数:

total_number_of_bytes = (no. of digits + 1) / 2

我写了以下代码来解压数字:

public String unpackData(String packedData, int decimalPointLocation) 
        String unpackedData = "";
        char[] characters = packedData.toCharArray();
        final int impliedPositive = 15;
        final int positiveNumber = 12;
        final int negativeNumber = 13;
        for (int currentCharIndex = 0; currentCharIndex < characters.length; currentCharIndex++) 
            byte[] unpackedDigits = unpackByte((byte) characters[currentCharIndex]);
            if(currentCharIndex == (characters.length - 1)) 
                if(unpackedDigits[1] == impliedPositive || unpackedDigits[1] == positiveNumber) 
                    unpackedData += String.valueOf(unpackedDigits[0]);
                 else if(unpackedDigits[1] == negativeNumber) 
                    unpackedData = "-" + unpackedData;
                
             else 
                unpackedData += String.valueOf(unpackedDigits[0]) + String.valueOf(unpackedDigits[1]);
            
        
        if(decimalPointLocation > 0) 
            unpackedData = unpackedData.substring(0, (decimalPointLocation - 1)) + 
                            "." + 
                            unpackedData.substring(decimalPointLocation);
        
        return unpackedData;
    

    private byte[] unpackByte(byte packedData) 
        byte firstDigit = (byte) (packedData >>> 4);
        firstDigit = setBitsToZero(firstDigit, 4, 8);

        //System.out.println(" firstDigit = "+ firstDigit + ", and its bit string after unpacking = " + getBitString(firstDigit, 7));

        byte secondDigit = setBitsToZero(packedData, 4, 8);
        //System.out.println("second digit = " + secondDigit + ", and its bit string of second digit after unpcking = " + getBitString(secondDigit, 7));

        byte[] unpackedData = new byte[2];
        unpackedData[0] = firstDigit;
        unpackedData[1] = secondDigit;
        return unpackedData;
    

    private byte setBitsToZero(byte number, int startBitPosition, int endBitPosition) 
        for (int i = startBitPosition; i < endBitPosition; i++) 
            number =  (byte) (number & ~(1 << i));
        
        return number;
    

该程序对整数类型值正常工作,但不适用于浮点类型值。

谁能告诉我我的程序是否正确?

【问题讨论】:

您是否验证了多个测试用例的数字序列是否正确?我看不到您在哪里添加 char '0' 或 48 以转换为可打印字符。您确定 String.valueOf() 返回字符 '0'..'9' 而不是整数字节值 0x00 .. 0x09 吗?将小数点插入字符串时出现问题?看起来 decimalPointLocation 1 是 .######,2 是 #.#####,3 是 ##.#### 等。JUnit 可用于验证您的 unpackData 函数在所有测试条件下都能正常工作。即使没有测试格式不正确的数据,也有很多极端情况需要检查。 ***.com/questions/17448008/… 浮点数与压缩十进制不同。 如果这些压缩字段中的任何一个被签名,你也必须处理它......通常,符号是用最低有效数字编码的。最后,压缩字段通常包含一个隐含的小数点,您将需要原始 COBOL 记录定义来对它们进行排序。 packedData &gt;&gt;&gt; 4中间多了一个&gt;符号。 【参考方案1】:

COMP-3(或“压缩十进制”)数据如下所示:0x12345s,其中“s”是 C 表示正数,D 表示负数,或 F 表示无符号数。因此 0x12345c -> "12345"、x012345d -> "-12345" 和 0x12345f -> "12345"。

您有一个明显的错误:如果符号为负,您将忽略包含符号 nybble 的字节中的 nybble(例如,上面的“5”)。此外,您在操纵 nybble 方面工作太辛苦了,这是一个简单的按位与或 4 位移位来隔离 nybble。

试试这样的东西(未经测试):

public String unpackData(String packedData, int decimalPointLocation) 
    String unpackedData = "";
    char[] characters = packedData.toCharArray();
    final int negativeSign = 13;
    for (int currentCharIndex = 0; currentCharIndex < characters.length; currentCharIndex++) 
        byte firstDigit = ((byte) characters[currentCharIndex]) >>> 4);
        byte secondDigit = ((byte) characters[currentCharIndex]) & 0x0F;
        unpackedData += String.valueOf(firstDigit);
        if (currentCharIndex == (characters.length - 1)) 
            if (secondDigit == negativeSign) 
                unpackedData = "-" + unpackedData;
            
         else 
            unpackedData += String.valueOf(secondDigit);
        
    
    if (decimalPointLocation > 0) 
        unpackedData = unpackedData.substring(0, (decimalPointLocation - 1)) + 
                        "." + 
                        unpackedData.substring(decimalPointLocation);
    
    return unpackedData;

【讨论】:

这个答案可能大部分时间都有效,从文件读取时它不可靠。将压缩十进制作为字符串读取可能会损坏压缩十进制。您必须将压缩十进制作为字节读取和处理。【参考方案2】:
public static final int UNSIGNED_BYTE = 0xff;
public static final int BITS_RIGHT = 0xf;

public long parseComp3(byte[] data) 
    long val = 0L;
    boolean negative = false;
    for (int i = 0; i < data.length; i++) 
        int raw = data[i] & UNSIGNED_BYTE;
        int digitA = raw >> 4;
        int digitB = raw & BITS_RIGHT;

        if (digitA < 10) 
            val *= 10L;
            val += (long) digitA;

         else if (digitA == 11 || digitA == 13)  // Some non-IBM systems store the sign on left or use 11 for negative.
            negative = true;
        

        if (digitB < 10) 
            val *= 10L;
            val += (long) digitB;

         else if (digitB == 11 || digitB == 13) 
            negative = true;
        
    
    if (negative)
        val = -val;
    return val;

【讨论】:

您是否想表达一些特别的东西,使这个答案比以前接受的答案更好? 我认为这是一个更好的答案,因为输入是一个字节数组,以字符格式读取 ebcdic comp-3 会损坏 comp-3 数据。【参考方案3】:

Ross Paterson 解决方案在将前 4 位向右移动时存在错误。必须应用掩码 0x0F。

这里是更正的方法:

private static String unpackData(byte[] packedData, int decimalPointLocation) 
    String unpackedData = "";

    final int negativeSign = 13;
    for (int currentCharIndex = 0; currentCharIndex < packedData.length; currentCharIndex++) 
        byte firstDigit = (byte) ((packedData[currentCharIndex] >>> 4) & 0x0F);
        byte secondDigit = (byte) (packedData[currentCharIndex] & 0x0F);
        unpackedData += String.valueOf(firstDigit);
        if (currentCharIndex == (packedData.length - 1)) 
            if (secondDigit == negativeSign) 
                unpackedData = "-" + unpackedData;
            
         else 
            unpackedData += String.valueOf(secondDigit);
        
    

    if (decimalPointLocation > 0) 
        int position = unpackedData.length() - decimalPointLocation;
        unpackedData = unpackedData.substring(0, position) + "." + unpackedData.substring(position);
    
    return unpackedData;

【讨论】:

【参考方案4】:

我已经测试了Ross Paterson 解决方案,运行不正常,但有一些小细节。感谢罗斯,也感谢 Dr. Bob 的“int raw”

测试解决方案在这里:

private static String unpackData(byte[] packedData, int decimals) 
    String unpackedData="";
    final int negativeSign = 13;
    int lengthPack = packedData.length;
    int numDigits = lengthPack*2-1;

    int raw = (packedData[lengthPack-1] & 0xFF);
    int firstDigit = (raw >> 4);
    int secondDigit = (packedData[lengthPack-1] & 0x0F);
    boolean negative = (secondDigit==negativeSign);
    int lastDigit = firstDigit;
    for (int i = 0; i < lengthPack-1; i++) 
        raw = (packedData[i] & 0xFF);
        firstDigit = (raw >> 4);
        secondDigit = (packedData[i] & 0x0F);
        unpackedData+=String.valueOf(firstDigit);
        unpackedData+=String.valueOf(secondDigit);

    
    unpackedData+=String.valueOf(lastDigit);
    if (decimals > 0) 
        unpackedData = unpackedData.substring(0,numDigits-decimals)+"."+unpackedData.substring(numDigits-decimals);
    
    if (negative)
        return '-'+unpackedData;
    
    return unpackedData;

以及将解包数据转换为打包数据的函数:

private static byte[] packData(String unpackedData) 
    int unpackedDataLength = unpackedData.length();
    final int negativeSign = 13;
    final int positiveSign = 12;
    if (unpackedData.charAt(0)=='-')
        unpackedDataLength--;
    

    if (unpackedData.contains("."))
        unpackedDataLength--;
    
    int packedLength = unpackedDataLength/2+1;

    byte[] packed = new byte[packedLength];
    int countPacked = 0;
    boolean firstHex = (packedLength*2-1 == unpackedDataLength);
    for (int i=0;i<unpackedData.length();i++)
        if (unpackedData.charAt(i)!='-' && unpackedData.charAt(i)!='.')
            byte digit = Byte.valueOf(unpackedData.substring(i,i+1)); 
            if (firstHex)
                packed[countPacked]=(byte) (digit<<4);
            else
                packed[countPacked]=(byte) (packed[countPacked] | digit );
                countPacked++;
            
            firstHex=!firstHex;
        
    
    if (unpackedData.charAt(0)=='-')
        packed[countPacked]=(byte) (packed[countPacked] | negativeSign );
    else
        packed[countPacked]=(byte) (packed[countPacked] | positiveSign );
    
    return packed;

【讨论】:

以上是关于COMP612 图形计算的主要内容,如果未能解决你的问题,请参考以下文章

OpenCV 直方图比较

无法从计算机 <comp name> 加载性能计数器

图形学算法收藏

电信光纤f612的猫怎么设置无线网络,我有超级用户密码了。

COMP9021--6.24

中信光纤猫 zxhn f612-gpon破解方法 超级用户